【问题标题】:Linking Problems with Poco libraryPoco 库的链接问题
【发布时间】:2014-04-17 07:07:45
【问题描述】:

我使用 Visual Studio 2012,但在开始使用 poco 库时遇到问题。 以下代码:

#include "stdafx.h"
#include "Poco/StreamCopier.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Net/SocketStream.h"
#include <iostream>
int main(int argc, char** argv)
{
Poco::Net::SocketAddress sa("www.appinf.com", 80);
Poco::Net::StreamSocket socket(sa);
Poco::Net::SocketStream str(socket);
str << "GET / HTTP/1.1\r\n"
"Host: www.appinf.com\r\n"
"\r\n";

str.flush();
Poco::StreamCopier::copyStream(str, std::cout);
return 0;
}

抛出以下错误:

C:\Users\christof\Documents\Visual Studio 2012\Projects\FTP\poco-1.4.6p3\poco-1.4.6p3\bin\PocoNet.dll : fatal error LNK1107: Invalid or broken file: Reading 0x2C0 not possible.

PocoNet.dll 就在正确的位置。我也在附加依赖项和 lib 位置中添加了 dll。但我仍然得到同样的错误。 我认为这绝对是初学者的失败,因为我是使用 c++ 和 Visual Studio 的绝对初学者。我假设我没有正确链接,但我不知道更好。 我希望有一个人可以帮助我。提前致谢,祝您有美好的一天。

【问题讨论】:

  • 感谢您的链接;我已经完成了与链接中完全相同的所有操作。但错误仍然发生。让别人有另一个想法。谢谢

标签: c++ dll linker poco


【解决方案1】:

首先你的调用应用程序必须加载PocoFoundation.dll,之后你可以使用Poco::SharedLibrary类来加载PocoNet.dllPoco::ClassLoader 实例化您需要的对象。 如果定义POCO_STATIC,则可以静态加载每个PocoXxxx.dll,如果定义POCO_DLL,则可以动态加载。 欲了解更多信息,请参阅PocoSharedLibraries.pdf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-22
    • 2021-03-03
    • 1970-01-01
    • 2011-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多