Eclipse C/C++ (CDT) add -l option (linking math module) gcc -lm

若如初见. 提交于 2019-12-17 19:42:29

问题


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?


回答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.




回答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).



来源:https://stackoverflow.com/questions/8480013/eclipse-c-c-cdt-add-l-option-linking-math-module-gcc-lm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!