Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi.

The following source generates the fault code "../Main.c:27: undefined reference to `sqrt'"

#include //Declarations from DAVE3 Code Generation (includes SFR declaration)
#include
#include

double dbDestination, dbSource;

int main(void)
{
DAVE_Init(); // Initialization of DAVE Apps

dbSource = 9;
dbDestination = sqrt(dbSource);
while(1)
{
}
return 0;
}


Does anyone know this problem ?


Thank you in advance,
Rudi
1 Reply
Not applicable
You have to tell the linker to link the math libraries.
You can do this in project properties -> tool settings -> ARM gcc linker -> Libraries.
You have to click add and then type an 'm' in the popup window,
this will link the math libraries with your project and solve your problem.