Page 1 of 1
CodeLite can't fin include files - <math.h>
Posted: Sun May 11, 2014 11:44 pm
by JimB
Loaded CodeLite on my Ubuntu machine, tried to build c-code and it could not find the include file <math.h>. Seemed to be ok with the include statement but could find the functions sqrt() and pow(). I know that the proper files are on my machne becaue Code::Blocks functions properly, and so does NetBeans IDE.
Re: CodeLite can't fin include files - <math.h>
Posted: Mon May 12, 2014 2:26 pm
by eranif
You should post the build information + your codelite version
http://forums.codelite.org/viewtopic.php?f=3&t=804
Eran
Re: CodeLite can't fin include files - <math.h>
Posted: Sat May 17, 2014 5:34 am
by JimB
CodeLite 5.4 (so now I will get an answer, doubtful)
To build a C-file using math.h, the GNU people say you have to link it. For a compile and link with the executable name same as file
in a terminal session you would enter:
gcc c_file.c -o c_file -lm
The -lm links the math lib. I had this same issue with Geany, however there is an option to set compiler options, i.e the -lm. Have not been able to
determine how to do this in codelite. This is the question to be answered.
For those who like the details:
/bin/sh -c 'make -j 2 -e -f Makefile'
----------Building project:[ Project_001 - Debug ]----------
make[1]: Entering directory `/home/jim/CodeLite_Workspace/Project_001'
gcc -o ./Debug/Project_001 @"Project_001.txt" -L.
./Debug/main.o: In function `main':
/home/jim/CodeLite_Workspace/Project_001/main.c:12: undefined reference to `sqrt'
collect2: error: ld returned 1 exit status
make[1]: *** [Debug/Project_001] Error 1
make[1]: Leaving directory `/home/jim/CodeLite_Workspace/Project_001'
make: *** [All] Error 2
1 errors, 0 warnings
Re: CodeLite can't fin include files - <math.h>
Posted: Sat May 17, 2014 6:14 am
by JimB
No need to respond ....
I resolved the issue myself.
Hope you guys enjoy reading all that build-log data.