CodeLite can't fin include files - <math.h>
-
- CodeLite Curious
- Posts: 3
- Joined: Sun May 11, 2014 11:28 pm
- Genuine User: Yes
- IDE Question: 123
- Contact:
CodeLite can't fin include files - <math.h>
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.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: CodeLite can't fin include files - <math.h>
You should post the build information + your codelite version
http://forums.codelite.org/viewtopic.php?f=3&t=804
Eran
http://forums.codelite.org/viewtopic.php?f=3&t=804
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 3
- Joined: Sun May 11, 2014 11:28 pm
- Genuine User: Yes
- IDE Question: 123
- Contact:
Re: CodeLite can't fin include files - <math.h>
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
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
-
- CodeLite Curious
- Posts: 3
- Joined: Sun May 11, 2014 11:28 pm
- Genuine User: Yes
- IDE Question: 123
- Contact:
Re: CodeLite can't fin include files - <math.h>
No need to respond ....
I resolved the issue myself.
Hope you guys enjoy reading all that build-log data.
I resolved the issue myself.
Hope you guys enjoy reading all that build-log data.