Poco ApplicationServer与Eclipse和Mingw的链接问题
Poco ApplicationServer linking issues with Eclipse and Mingw
我试图从poco工作中获得基本的ApplicationServer示例。我正在使用:
Windows 7MinGW少Eclipsec++
所以经过一堆的黑客和设置,我终于让它工作。但我不知道我的黑客做了什么,我想要一个合适的解决方案,而不是我的黑客。
我的问题是,它给了我一堆"未解决的引用XX",当我构建。这些是从poco库中弹出的,它们不是我在代码中使用的东西。我的方法是,在我的Server.cpp中,遍历引用的每个类,并使用它们。简单地声明它们是不够的,我必须实际使用对象。一旦我使用了它所抱怨的所有内容,它就会按预期进行编译并运行。这似乎是一种行为,将指示一个简单的配置解决方案给知道发生了什么的人。
我认为我可以总结的事情:
- poco库已经建立正确(他们工作一旦我有这个hack到位)
- MinGW工作正常
- eclipse设置可能没有正确链接。
所以我的问题是:有没有人知道是什么设置错了,可能导致这种行为?我如何用一个"干净"的解决方案来解决这个问题,而不是我那令人无法接受的凌乱的hack?
我的hack main解决问题:
int main(int argc, char** argv)
{
std::cout << "test1" << std::endl;
std::cout.flush();
AgentServer app;
app.run(argc, argv);
LoggingFactory::defaultFactory();
AutoPtr<ConsoleChannel> pCCChannel(new ConsoleChannel);
AutoPtr<FileChannel> pChannel(new FileChannel);
pChannel->setProperty("path", "sample.log");
pChannel->setProperty("rotation", "2 K");
pChannel->setProperty("archive", "timestamp");
Logger::root().setChannel(pChannel);
Logger& logger = Logger::get("TestLogger"); // inherits root channel
poco_warning(logger, "This is a warning");
try
{
Path myPath = new Path();
poco_warning(logger, myPath.current());
int i = NumberParser::parse("5");
FileOutputStream myFileOutputStream("test.file");
myFileOutputStream << "test";
OutputLineEndingConverter conv(myFileOutputStream," ");
std::stringstream xmlstream("test");
UTF8Encoding myUTF8Encoding;
XMLWriter writer(xmlstream,0,"UTF-8", &myUTF8Encoding);
std::ostringstream ostr1("test2");
OutputStreamConverter converter1(ostr1,myUTF8Encoding,myUTF8Encoding);
URI uri;
uri.getHost();
URIStreamOpener opener;
opener.open(uri);
} catch(...)
{
poco_warning(logger, "Swallowing exception");
}
//poco_warning(logger,);
//AgentServer app;
//return app.run(argc, argv);
}
当你构建poco时,你会得到一个名为"lib"的文件夹。让你的链接器指向那个包含poco所有库的文件夹。现在应该没有任何链接错误了。如果显示*.dll文件丢失:
- 然后从文件夹"(pocobuild路径)bin"复制内容到项目构建位置。,
- 为环境变量(path)添加"(pocobuild path)bin"路径。
相关文章:
- 使用jsoncpp库时出现链接问题
- Cmake 链接问题:未定义对 Button::mousePressEvent(QGraphicsSceneMouseE
- 如何将GTest与CMake一起使用?遵循谷歌指南时的链接问题
- 未解决的外部链接问题
- 'make check' GLIBC 运行时的链接问题
- 在树莓派上用libtorch构建程序时的链接问题
- 野牛弹性链接问题
- 与 AWS 开发工具包的链接问题
- Qt & Firebase C++ SDK 在 iOS 上的链接问题
- 链接问题 boost::p ython::numpy.
- 与 32 位共享对象的链接问题
- 在单元测试项目中包括 .c 文件,并从多个 cpp 文件访问它而不会出现链接问题
- 安卓链接问题
- LLVM 传递链接问题:未定义的符号
- Cmake Mac OSX库链接问题:在Linux上进行编译,但在Mac上进行了编译
- 用libclang解析源文件 - 链接问题包括文件
- C / C++链接问题与非常简单的设置
- Zbar 在 vs2015 链接问题
- Vulkan + GLFW + Cmake在Linux环境下的链接问题
- TFS构建由于链接问题而失败