Eclipse C/C++ (CDT) add -l option (linking math module) gcc -lm
Solution 1
Somewhere along this path: Project->Properties->C/C++ Build->Settings, then under the Tools tab: GCC Linker->Libraries
As for where it is in the system, usually /usr/lib/libm.so.
FYI, this is all true of my system, but may differ slightly on yours for any number of reasons. Shouldn't be hard to adjust if needed.
Solution 2
Go to Project and select Properties. Expand C/C++ Build and choose Settings. Under the Tool settings tab expand GCC Linker and select Libraries. At the right of the window, add a library named m at Libraries (-l).
eat_a_lemon
Updated on July 09, 2022Comments
-
eat_a_lemon almost 2 years
I am trying to have eclipse on linux (Ubuntu) link the math module. Normally I would link with gcc -lm. How do I get eclipse to add this? Is it in library paths under Project->Properties? Where does the math module reside on a linux Ubuntu system?
-
eat_a_lemon over 12 yearsI found the -l option under C/C++ build => Settings => GCC C Linker => Libraries
-
dom over 8 years@loan I am facing same problem and I found "libm.so" But I don't know what to do next ??? plz guide
-
Andrea993 almost 8 yearsYou can easily add the character
m
instead of the path. It works for me. It cause the parameter-lm
-
Chris Good about 4 yearsWhere do you do that in eclipse 2019-12? My C/C++ project is using cmake + ninja. Do I have to recreate the project? Setting LD_LIBRARY_PATH in workspace preferences, C/C++, Build, Environment doesn't work.