简体   繁体   English

Eclipse C / C ++(CDT)添加-l选项(链接数学模块)gcc -lm

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

I am trying to have eclipse on linux (Ubuntu) link the math module. 我试图让eclipse在linux(Ubuntu)链接数学模块。 Normally I would link with gcc -lm. 通常我会链接gcc -lm。 How do I get eclipse to add this? 如何让eclipse添加这个? Is it in library paths under Project->Properties? 它是在Project-> Properties下的库路径中吗? Where does the math module reside on a linux Ubuntu system? 数学模块在Linux Ubuntu系统上的位置是什么?

Somewhere along this path: Project->Properties->C/C++ Build->Settings, then under the Tools tab: GCC Linker->Libraries 沿着这条路径的某个地方:Project-> Properties-> C / C ++ Build-> Settings,然后在Tools选项卡下:GCC Linker-> Libraries

As for where it is in the system, usually /usr/lib/libm.so. 至于它在系统中的位置,通常是/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. 如果需要,不应该很难调整。

Go to Project and select Properties . 转到Project并选择Properties Expand C/C++ Build and choose Settings . 展开C / C ++ Build并选择Settings Under the Tool settings tab expand GCC Linker and select Libraries . 在“ 工具设置”选项卡下,展开“ GCC链接器”,然后选择“ 库” At the right of the window, add a library named m at Libraries (-l) . 在窗口右侧,在Libraries(-l)中添加名为m

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM