Overview
Features
Download
Documentation
Community
Add-Ons & Services

Static Link Errors, Windows, VS 2005

Please post support and help requests here.

Static Link Errors, Windows, VS 2005

Postby glindsay » 28 Jul 2008, 18:45

I am very pleased with POCO, so far (we are evaluating it.) However, I have run into a problem.

Under Visual Studio 2005, I am trying to compile a statically linked executable, which will be self-contained at run time, that uses the POCO 1.3.2 libraries.

In preparation, I copied and edited the build_vs80.cmd file to build the debug_static and release_static libraries, like so:

devenv /useenv /rebuild debug_static Foundation_vs80.sln
devenv /useenv /rebuild release_static Foundation_vs80.sln
... etc.

Running this file created the *mt.lib and *mtd.lib files under {poco_root}lib. (E.g., PocoFoundationmtd.lib, PocoNetmtd.lib, etc.)

I added the POCO_STATIC preprocessor definition to my project properties.

I added PocoFoundationmtd.lib, PocoNetmtd.lib, and PocoXMLmtd.lib to my linker inputs.

When I compile, however, I get 30 or so link errors along the lines of:

PocoNetmtd.lib(SocketAddress.obj) : error LNK2019: unresolved external symbol __imp__getservbyname@8 referenced in function "protected: unsigned short __thiscall Poco: :Net: :SocketAddress: :resolveService(class std: :basic_string,class std: :allocator > const &)" (?resolveService@SocketAddress@Net@Poco@@IAEGABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)

PocoNetmtd.lib(IPAddress.obj) : error LNK2019: unresolved external symbol __imp__ntohl@4 referenced in function "public: virtual bool __thiscall Poco: :Net: :IPv4AddressImpl: :isLoopback(void)const " (?isLoopback@IPv4AddressImpl@Net@Poco@@UBE_NXZ)

... etc.

I feel I am missing something basic and obvious, but may I ask anyway, How do I resolve these linking errors?

Thanks.

Sincerely,
Grant Lindsay
glindsay
 
Posts: 2
Joined: 25 Jul 2008, 16:59
Location: United_States

Re: Static Link Errors, Windows, VS 2005

Postby guenter » 28 Jul 2008, 21:54

Grant,

try adding the following libraries to the Linker/Input/Additional Dependencies setting: ws2_32.lib iphlpapi.lib (Winsock 2 and the IP Helper API).

Best regards,

Günter

guenter
 
Posts: 1153
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Re: Static Link Errors, Windows, VS 2005

Postby glindsay » 28 Jul 2008, 22:35

> try adding the following libraries to the Linker/Input/Additional Dependencies setting: ws2_32.lib iphlpapi.lib (Winsock 2 and the IP Helper API).

Hi Günter,

Thank you. That did the trick.

Sincerely,

Grant Lindsay
glindsay
 
Posts: 2
Joined: 25 Jul 2008, 16:59
Location: United_States

Re: Static Link Errors, Windows, VS 2005

Postby alex » 29 Jul 2008, 12:59

^
> Under Visual Studio 2005, I am trying to compile a statically linked executable, which will be self-contained at run time, that uses the POCO 1.3.2 libraries.^

Bear in mind that, although statically linked with POCO libraries, your executable is dynamically linked with runtime libraries and will need the runtime DLLs on the target machine. Until VS 2003, it was enough to just copy the runtime DLLs in your application directory or somewhere in the path, but since VS 2005 you have to install the redistributable package.

Alex
alex
 
Posts: 1143
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron