pombreda / libkml

Automatically exported from code.google.com/p/libkml
Other
0 stars 0 forks source link

libkmlbase does not compile with Visual Studio 2008 (express edition) #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. "Build Solution" straight after solution conversion

What is the expected output? What do you see instead?
VS2008 is quite picky about some functions, and some standard C/C++
functions issue security warnings. So I'd expect something like "libkmlbase
- 0 error(s), N warning(s)" where N is more than one. What I saw is
something like:
[...successful operations, with warnings...]
time_util.cc
c:\development\microsoft\sdk\include\ws2def.h(91) : warning C4005: 'AF_IPX'
: macro redefinition
        c:\development\microsoft\sdk\include\winsock.h(460) : see previous
definition of 'AF_IPX'
c:\development\microsoft\sdk\include\ws2def.h(127) : warning C4005:
'AF_MAX' : macro redefinition
        c:\development\microsoft\sdk\include\winsock.h(479) : see previous
definition of 'AF_MAX'
c:\development\microsoft\sdk\include\ws2def.h(163) : warning C4005:
'SO_DONTLINGER' : macro redefinition
        c:\development\microsoft\sdk\include\winsock.h(402) : see previous
definition of 'SO_DONTLINGER'
c:\development\microsoft\sdk\include\ws2def.h(206) : error C2011:
'sockaddr' : 'struct' type redefinition
        c:\development\microsoft\sdk\include\winsock.h(485) : see
declaration of 'sockaddr'
c:\development\microsoft\sdk\include\ws2def.h(384) : error C2143: syntax
error : missing '}' before 'constant'
c:\development\microsoft\sdk\include\ws2def.h(384) : error C2143: syntax
error : missing ';' before 'constant'
[...more errors...]

What version of the product are you using? On what operating system?
I'm using version 0.4, to be compiled (as stated) with VS2008 Express (the
MS SDK I installed is the Windows Server 2003 SDK). The OS is Vista, but
being this a compilation issue I'm not sure whether or not it matters.

Did you run the unit test suite that comes with the project? Did all tests
pass?
No, not still! ;-)

Please provide any additional information below.
Digging through forums I saw that someone gave a workaround to similar
problems by simply including "winsock2.h" _before_ "windows.h" (which
sounds strange). Apparently this works here too: libkmlbase compiles (with
warnings) after swapping lines 29 and 30 in time_util.cc. I didn't try any
tests though.

Original issue reported on code.google.com by almost.e...@gmail.com on 17 Oct 2008 at 6:18

GoogleCodeExporter commented 9 years ago
We changed the inclusion of winsock2 to plain old winsock because of this bug:
http://code.google.com/p/libkml/issues/detail?id=27

I'll try your ordering fix on my VS 2005 and see if the old problem comes back.

(If anyone knows the definitive answer to this problem, I'm all ears.)

Original comment by kml.mash...@gmail.com on 19 Oct 2008 at 5:17

GoogleCodeExporter commented 9 years ago
Fixed: http://code.google.com/p/libkml/source/detail?r=288

Original comment by kml.mash...@gmail.com on 21 Oct 2008 at 10:07