How to add compiler options in Eclipse IDE

只愿长相守 提交于 2019-12-08 05:47:45

问题


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)

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


回答1:


If you are using gcc, you can go to Project \ Properties

In the properties dialog box, go to C/C++ Build\ Settings\GCC C++ Compiler\ Miscellaneous,

and add -lPocoNet to "Other flags" as shown below.



来源:https://stackoverflow.com/questions/26371215/how-to-add-compiler-options-in-eclipse-ide

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