問題描述
我的構建要求我發出以下命令:
My build requires that I issue the following commands:
$ g++ sniff.cpp -o sniff -lcrafter
但是,在我的 Eclipse 構建中,編譯器得到的只是:
However, in my Eclipse build, all the complier gets is:
g++ -o "sniffer_crafter" ./src/sniffer_crafter.o
收到這些命令后,它抱怨我有一個未定義的對庫 Crafter 的引用.
After getting these commands it complains that I have an undefined reference to the library Crafter.
如何使用 Eclipse 解決此鏈接問題?我見過其他人對類似問題的回答,但他們似乎沒有解決 Eclipse 的當前布局.我正在使用最新版本的 Eclipse Kepler.
How can I resolve this linking issue using Eclipse? I have seen others answers to similar questions, but they don't seem to address Eclipse's current layout. I'm using the most recent edition of Eclipse Kepler.
推薦答案
包含庫:-
右鍵項目 -->
- 轉到屬性
- 然后轉到 --> C/C++ Build --> 設置
在那里你會找到鏈接器和子類型庫.
There you will find Linker and sub type Libraries.
在右側的庫搜索路徑中添加庫路徑(您的 .so 文件所在的位置)并在庫中提供庫名稱
Add the library path in Library Search Path on right hand side (where your .so file is located) and give the lib name in libraries
對于 libcrafter.so 路徑 -->/opt/myLib/lib
for libcrafter.so path --> /opt/myLib/lib
將路徑指定為/opt/myLib/lib和庫名稱作為工匠
give path as /opt/myLib/lib and library name as crafter
這篇關于Eclipse 中的編譯器標志的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!