...
: error LNK2019: unresolved external symbol__imp__htons,...

: error LNK2019: unresolved external symbol __imp__WSAGetLastErro
...

These are functions from Ws2_32.lib or kernel32.lib , and I am sure
visual studio project setting about lib reference is right.

/ERRORREPORT:PROMPT glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib
intl.lib libxml2.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib .

My project is a c project, calling convention is __cdecl (/Gd),
compiled to /TC.

My visual studio is vs 2005 sp1.

Any suggestions will be appreciated. Thank you in advance.

Re: Question I can't get around this common problem now, unresolved by Norbert

Norbert
Thu Jul 24 14:57:40 CDT 2008



DDD schrieb:
> ...
> : error LNK2019: unresolved external symbol__imp__htons,...
>
> : error LNK2019: unresolved external symbol __imp__WSAGetLastErro
> ...
>
> These are functions from Ws2_32.lib or kernel32.lib , and I am sure
> visual studio project setting about lib reference is right.
>
> /ERRORREPORT:PROMPT glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib
> intl.lib libxml2.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib .

It seems your project is using Winsock2. Do you include Winsock2.h? If yes,
where? As far as I remember, when using winsock2 you need to include winsock2.h
before windows.h.

Norbert

Re: Question I can't get around this common problem now, unresolved by DDD

DDD
Mon Jul 28 19:56:40 CDT 2008

On Jul 25, 3:57=A0am, Norbert Unterberg <nunterb...@newsgroups.nospam>
wrote:
> DDD schrieb:
>
> > ...
> > : error LNK2019: unresolved external symbol__imp__htons,...
>
> > : error LNK2019: unresolved external symbol __imp__WSAGetLastErro
> > ...
>
> > These are functions from Ws2_32.lib or kernel32.lib , and I am sure
> > visual studio project setting about lib reference is right.
>
> > =A0/ERRORREPORT:PROMPT glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib
> > intl.lib libxml2.lib Ws2_32.lib =A0kernel32.lib user32.lib gdi32.lib .
>
> It seems your project is using Winsock2. Do you include Winsock2.h? If ye=
s,
> where? As far as I remember, when using winsock2 you need to include wins=
ock2.h
> before windows.h.
>
> Norbert

Thank you, Norbert.

I have resolved this problem by removing a predefined macro MS_VER.
But I don't know what have happened to the compiler, if I set this
macro. A strange thing?

Thank you again.