[RESOLVED] Poco includes conflicting with SOAP

Please post support and help requests here.
Latt
Posts: 7
Joined: 30 Jun 2009, 23:14

[RESOLVED] Poco includes conflicting with SOAP

Postby Latt » 14 Jul 2009, 17:00

Hi everyone,

I have used Poco Libraries to code a mail client and integrated the code into the main project where I am already using SOAP to connect to a Webservice. All compiled well while still being seperately, but now that I am putting the pieces together , I am getting 100 errors (type redefinition/macro redefinition) referring to winsock.h, winsock2.h, ws2tcpip.h and wspiapi.h.

The reason seems quite obvious, both Poco and SOAP are including these headers - but : there are include guards in all these files, so why can this still happen ?

I hope someone can give me a hint.
Last edited by Latt on 14 Jul 2009, 22:54, edited 1 time in total.

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

Re: Poco includes conflicting with SOAP

Postby guenter » 14 Jul 2009, 19:19

Its probably because of a wrong include order of <windows.h> and <winsock2.h>. The latter should always be included before the former, otherwise Bad Things Can Happen. Microsoft, in its infinite wisdom, decided to include <winsock.h> in <windows.h>, unless <winsock2.h> has already been included (or some macros are defined), thus creating endless opportunities for fun and joy for everyone having to deal with libraries from different sources. Other ways to fix this are defining WIN32_MEAN_AND_LEAN or #defining _WIN32_WINNT to a value >= 0x0400, all before including <windows.h> (that means, in your project settings).

Latt
Posts: 7
Joined: 30 Jun 2009, 23:14

Re: Poco includes conflicting with SOAP

Postby Latt » 14 Jul 2009, 22:54

Thanks a bunch guenter !

Just moving #include <Mail.h> at the top of my includes eliminated all errors :D


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest

cron