How to statically link using link.exe

It sounds like the problem is that the PocoNet.lib file is an import library for the poco.dll. So the externs it resolves are to the DLL.

You'll need to find or build a static library for Poco (if possible).


You have to define POCO_STATIC on the command line and link with both PocoFoundationmt and PocoNetmt.lib:

C:\test>cl /MD /WX /nologo /EHsc /DPOCO_STATIC /DUNICODE /D_UNICODE /I..\poco\Foundation\include /I ..\poco\Net\include /c exp.cpp

exp.cpp

C:\test>link /libpath:..\poco\lib /WX /nologo exp.obj PocoNetmt.lib PocoFoundationmt.lib

[UPDATE] If you compile with /DPOCO_STATIC, then it isn't necessary to specify the POCO libraries on the linker command line. The header files contain #pragma comment(lib, "PocoXXXmt.lib") statements that should ensure that all the necessary libraries will be linked in.

If you don't compile with /DPOCO_STATIC, then the DLL import libraries will be automatically linked instead. [/UPDATE]