如何在Eclipse IDE中添加编译器选项 [英] How to add compiler options in Eclipse IDE
问题描述
我正在创建一个与天气API交互的应用程序,为此,我正在使用Poco的HTTPClientSession库,但是在编译时却遇到了错误
I'm creating an application that interfaces with a weather API, and to do so I'm using Poco's HTTPClientSession library, but I'm getting an error at compile time
Undefined symbols for architecture x86_64:
"Poco::Net::HTTPRequest::setHost(std::__1::basic_string<char,std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPRequest::HTTPRequest()", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPRequest::~HTTPRequest()", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPResponse::HTTPResponse()", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPResponse::~HTTPResponse()", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPClientSession::sendRequest(Poco::Net::HTTPRequest&)", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPClientSession::HTTPClientSession(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short)", referenced from:
Weather::getCSV() in Weather.o
"Poco::Net::HTTPClientSession::~HTTPClientSession()", referenced from:
Weather::getCSV() in Weather.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
从我的研究中我知道,此错误是由调用编译器时需要使用选项-lPocoNet
引起的,但是我使用的是eclipse IDE,因此我不确定如何在实现该效果的同时使用日食
I know from my research that this error is caused by a need for the option -lPocoNet
to be used when calling the compiler, but I use the eclipse IDE, so I'm not sure how to implement the same effect while using eclipse
推荐答案
如果使用的是gcc
,则可以转到Project \ Properties
If you are using gcc
, you can go to Project \ Properties
在属性对话框中,转到"C/C ++ Build \设置\ GCC C ++编译器\其他",
In the properties dialog box, go to C/C++ Build\ Settings\GCC C++ Compiler\ Miscellaneous,
,然后将-lPocoNet
添加到其他标志",如下所示.
and add -lPocoNet
to "Other flags" as shown below.
这篇关于如何在Eclipse IDE中添加编译器选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!