Compiling Problem with VC 2012

Bug #1096572 reported by Travis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Undecided
Joris Dauphin

Bug Description

I installed Visual Studio 2012 and I am having issues with errors saying there's a "C4005 - Macro Redefinition" error. I don't know how to go about getting this to go away, but I can't compile...

Anyone know how to fix it?

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

I will try to reproduce (and fix) with vs express 2010.
gcc complaints only when define differs.
if it is directly in your code
-- 8< --
#ifndef duplicated_macro
#define duplicated_macro value
#endif
-- >8 --
should solve the problem for each duplicated macro.

Changed in stratagus:
assignee: nobody → Joris Dauphin (joris-dauphin)
Revision history for this message
Travis (dinky-dye-aussie) wrote :

it's in the file "xkeycheck.h", that's where the error is. not in the game source code. Here's the warning/error message I'm getting at least 10 million times in the compiler window

3>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xkeycheck.h(199): warning C4005: 'inline' : macro redefinition
3>C:\Games\Stratagus\trunk\src\include\stratagus.h(56) : see previous definition of 'inline'
3>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

There are no references in any Game Source files

Revision history for this message
Travis (dinky-dye-aussie) wrote :

hmmm. seems I was wrong. the error is in stratagus.h, line 57. It's saying the word "inline" is a macro redefinition. maybe it's not allowed to be redefined now in VC2012...

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

I have just remove the define inline from stratagus.h since it is nearly useless.

Revision history for this message
Travis (dinky-dye-aussie) wrote :

That fix worked Joris, but I have a new problem, this time with the Linker.

I keep getting a LNK2019 error. these five lines from the compiler/linker output

2>iolib.obj : error LNK2019: unresolved external symbol _BZ2_bzopen@8 referenced in function "public: int __thiscall CFile::PImpl::open(char const *,long)" (?open@PImpl@CFile@@QAEHPBDJ@Z)
2>iolib.obj : error LNK2019: unresolved external symbol _BZ2_bzread@12 referenced in function "public: int __thiscall CFile::PImpl::read(void *,unsigned int)" (?read@PImpl@CFile@@QAEHPAXI@Z)
2>iolib.obj : error LNK2019: unresolved external symbol _BZ2_bzwrite@12 referenced in function "public: int __thiscall CFile::PImpl::write(void const *,unsigned int)" (?write@PImpl@CFile@@QAEHPBXI@Z)
2>iolib.obj : error LNK2019: unresolved external symbol _BZ2_bzflush@4 referenced in function "public: void __thiscall CFile::PImpl::flush(void)" (?flush@PImpl@CFile@@QAEXXZ)
2>iolib.obj : error LNK2019: unresolved external symbol _BZ2_bzclose@4 referenced in function "public: int __thiscall CFile::PImpl::close(void)" (?close@PImpl@CFile@@QAEHXZ)

I don't know where to look as the file is an .OBJ file, not a .CPP/.H. Any ideas what it could be?

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

it is because you use bz2 but you miss to link with bz2...
A workaround is to modify In src/stratagus/iolib.cpp

by adding
-- 8< --
#undef USE_BZ2LIB
-- >8 --

just before the fist (line 53)
-- 8< --
#ifdef USE_BZ2LIB
-- >8 --

This will disable bz2 (so link with it is useless).

I don't use bz2... but code/cmake looks good.

How do you get bz2 libraries ?

Revision history for this message
Travis (dinky-dye-aussie) wrote :

I just downloaded the MSVC libs for stratagus, and the latest version had the BZIP2 libs in it.

That worked man thanks for that. For now it builds successfully with VC2012. How is Cybermind going with the peasent navigation bug?

Changed in stratagus:
status: New → Fix Committed
cybermind (iddqd-mail)
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.