Undefined reference to functions in math.h etc

Discussions about the AI-deck
Post Reply
emiliodc
Beginner
Posts: 3
Joined: Wed Jan 05, 2022 11:23 am

Undefined reference to functions in math.h etc

Post by emiliodc »

Hello. I have an AI-Deck and a Crazyflie 2.1 and I am using the GAP SDK from the docker image. Flashing to the board and running simple code and the examples run fine, following the instructions from the documentation. Now, I want to run some algorithm I had running on my computer, which includes math.h (more specifically, it uses sqrt() and log()), and then I am getting this "undefined reference to <function>" error when compiling.

What should I do to get those to work?
emiliodc
Beginner
Posts: 3
Joined: Wed Jan 05, 2022 11:23 am

Re: Undefined reference to functions in math.h etc

Post by emiliodc »

I added "LIBSFLAGS += -lm" to my Makefile and now it works.
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Undefined reference to functions in math.h etc

Post by kimberly »

Sorry for the late reply! A lot of us were on vacation still last week.

Great you were able to solve it on your own! It needs to be included in the makefile indeed if you use any external libraries.
Post Reply