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

后端 未结 2 1374
无人共我
无人共我 2020-12-10 16:20

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 Proje

相关标签:
2条回答
  • 2020-12-10 17:06

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

    0 讨论(0)
  • 2020-12-10 17:15

    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.

    0 讨论(0)
提交回复
热议问题