kastnermario / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

[patch] VS2002 compile fix for yaml-cpp library (traits.h: long long not allowed) #90

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Go to trunk
2. mkdir bin\vc2002
3. cd bin\vc2002
4. del /s /q * & rmdir /s /q .
5. "%ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\vcvars32.bat"
6. cmake -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 7" ..\..
   Note that I use the patched CMakeLists.tx from issue #87
6. Build any configuration with VS 2002

What is the expected output? What do you see instead?
Expected is that the library gets build.
Instead an error message is displayed that "long long" is not allowed.

What version of the product are you using? On what operating system?
MS Visual Studio 2002 SP1 Pro on Win XP SP3

Please provide any additional information below.

Before VS2003 Microsoft did not support "long long", instead the 
Microsoft-specific "__int64" had to be used.
The attached patch fixes this.

Original issue reported on code.google.com by matthias...@gmail.com on 10 Jan 2011 at 6:10

GoogleCodeExporter commented 8 years ago
Even with the patch there's still an issue with traits.h and VS2002, which I 
have no clue how to fix:
include\yaml-cpp\traits.h(38) : error C2065: 'T' : undeclared identifier
include\yaml-cpp\traits.h(38) : error C2687: cannot define a nested UDT of a 
template class out of line
include\yaml-cpp\traits.h(38) : fatal error C1903: unable to recover from 
previous error(s); stopping compilation

Code is:
    template <class T>
    struct enable_if_c<false, T> {};

Original comment by matthias...@gmail.com on 10 Jan 2011 at 6:33

GoogleCodeExporter commented 8 years ago
It turned out that defining LONGLONG macro collides with newer Windows SDKs.
Use direct replacement instead.

Original comment by matthias...@gmail.com on 10 Jan 2011 at 7:47

Attachments:

GoogleCodeExporter commented 8 years ago
On a related note: 
In gcc with the -pedantic flag, you get the error
yaml-cpp-0.2.5/include/traits.h:20: error: ISO C++ 1998 does not support `long 
long'

Maybe using typedefs such as uint64_t from stdint.h will provide more defined 
behavior?

Original comment by david130...@gmail.com on 25 Jan 2011 at 10:50

GoogleCodeExporter commented 8 years ago
Hi David, "gcc" is a little bit unspecific.
On Windows under MinGW I could compile it with GCC 3.2.3 and GCC 4.5.0 without 
any issues.
Only experienced this "long long not allowed" issue with Visual C++ 2002 and 
earlier.

Original comment by matthias...@gmail.com on 26 Jan 2011 at 5:16

GoogleCodeExporter commented 8 years ago
Fixed, r435.

To confirm: with the patch listed above, you no longer get that compiler error 
listed in comment 1 (http://code.google.com/p/yaml-cpp/issues/detail?id=90#c1)?

Original comment by jbe...@gmail.com on 2 Mar 2011 at 5:17