C++ g中未定义的引用错误++
我有以下代码:C++ g中未定义的引用错误++,c++,compilation,poco-libraries,C++,Compilation,Poco Libraries,我有以下代码: #include "Poco/Net/DatagramSocket.h" #include "Poco/Net/SocketAddress.h" #include "Poco/Timestamp.h" #include "Poco/DateTimeFormatter.h" int main(int argc, char** argv) { Poco::Net::SocketAddress sa("127.0.0.1", 80
#include "Poco/Net/DatagramSocket.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Timestamp.h"
#include "Poco/DateTimeFormatter.h"
int main(int argc, char** argv)
{
Poco::Net::SocketAddress sa("127.0.0.1", 8080);
Poco::Net::DatagramSocket dgs(sa);
std::string syslogMsg;
Poco::Timestamp now;
syslogMsg = Poco::DateTimeFormatter::format(now,
"<14>%w %f %H:%M:%S Hello, world!");
return 0;
}
我使用以下命令行进行编译:
g++ -L/usr/local/lib -lPocoUtil -lPocoFoundation -lPocoNet pocoSender.cpp -o hello
请不要将问题标记为重复,因为我已经使用g++标志包含了所需的库,但我仍然收到这些错误。这意味着编译器或链接器没有找到这些函数的实现。项目的构建中似乎没有包含相应的库或对象模块。库在命令行上查找源文件和对象文件。可能-L/usr/local/lib指的是不存在lib的地方。同样值得怀疑的是,您将如何在链接器命令上指定pocoSender.cpp,它应该出现在库规范之前…可能重复
g++ -L/usr/local/lib -lPocoUtil -lPocoFoundation -lPocoNet pocoSender.cpp -o hello