0

I work with Visual Studio 2012 and have problems getting started with the poco library. The following Code:

#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;
}

Throws the following error:

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.

The PocoNet.dll is exactly at the right place. I added the dll in the additional dependencies und the lib location too. But still I get the same error. I assume that is an absolute beginner failure, because I'm an absolute beginner in working with c++ and Visual Studio. I assume I haven't linked correctly, but I don't know better. I hope someone can help me. Thanks in advance and have a nice day.

Robert
  • 10,403
  • 14
  • 67
  • 117
user1235183
  • 3,002
  • 1
  • 27
  • 66

1 Answers1

0

First of all your calling application must load PocoFoundation.dll, after which you can use the class Poco::SharedLibrary to load PocoNet.dll and Poco::ClassLoader to instantiate objects that you need. Every PocoXxxx.dll can be loaded statically if you define POCO_STATIC or dynamically if you define POCO_DLL. For more informations see PocoSharedLibraries.pdf

Sergio
  • 891
  • 9
  • 27