Building the CvGameCore.dll with VC++ 2008 Express

CommanderZ

Warlord
Joined
Nov 24, 2007
Messages
182
Location
Prague, Czech. Rep.
Hello,
I downloaded the VS 2005 SDK from this site yesterday. I tried to compile it today (without any changes in code or project settings), but it returned a lengthy list of problems. Most of them are insecure function warnings (no problem), but there are also some serious errors.

First errors are these two:
Code:
.\CvUnitAI.cpp(8666) : error C2065: 'iI' : undeclared identifier
.\CvUnitAI.cpp(8940) : error C2065: 'iI' : undeclared identifier
Then several files later there are similiar errors:
Code:
.\CvGameTextMgr.cpp(7723) : error C2065: 'iI' : undeclared identifier
.\CvGameTextMgr.cpp(7723) : error C2065: 'iI' : undeclared identifier
.\CvGameTextMgr.cpp(7723) : error C2065: 'iI' : undeclared identifier
.\CvGameTextMgr.cpp(7725) : error C2065: 'iI' : undeclared identifier
.\CvGameTextMgr.cpp(7727) : error C2065: 'iI' : undeclared identifier
.\CvGameTextMgr.cpp(7730) : error C2065: 'iI' : undeclared identifier
and one new
Code:
.\CvGameTextMgr.cpp(7730) : error C2228: left of '.getDescription' must have class/struct/union
This is probably last conventional error
Code:
.\CvGame.cpp(5974) : error C2065: 'iTeam' : undeclared identifier
but there are also many "pdb corrupted" errors (I tried to delete the file and to rebuild the project, no effect) like this
Code:
.\CvDLLButtonPopup.cpp(3) : error C2471: cannot update program database 'c:\documents and settings\mzabsky\dokumenty\visual studio 2008\projects\cvgamecoredll\release\vc70.pdb'
.\CvDLLButtonPopup.cpp(2515) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Complete error report is in attachment.

I can roll back to VS 2005 if it is necessary, I started using 2008 cca three weeks ago.

Thanks for help
 

Attachments

Hi.

All I can give you is an up-to-date tutorial in German how to build the gamecoredll. :D You will find links to all need programms (all free) und many pictures that will help you.

Bye.
 
Don't even bother trying to compile the SDK in 2008. It's TWO full versions ahead of what Civ4 was programmed in (2003).

So just use 2005 or codeblocks which we know works. Or better yet, 2003. :)
 
The problem is bad programming practice. They are declaring iterators in a "for" loop, then trying to use them later.

The proper fix is to go to those sections and declare the iterator variables before the loop, so they'll be available outside the loop.

The simpler fix is to open the project properties, go to the "Language" section under "C/C++", and change "Force Conformance In For Loop Scope" to "No (/Zc:forScope-)".
 
Oh, thanks! It seems to work, but I get another error (followed by several pdb corruped errors)
Code:
.\CvCityAI.cpp(5731) : error C3867: 'CvCity::getProductionTurnsLeft': function call missing argument list; use '&CvCity::getProductionTurnsLeft' to create a pointer to member
CvCity.cpp
Shall I attempt to correct it (put & there)? And why does the pdb file corrupted everytime an error occurs? In my own C++ project, the complier always recompiles only the necessary stuff and everything is very fast. And here I have to sit back and wait evertime I try to build it :(
 
Have you made changes to the source yet? The error seems to be suggesting there's a line containing just "getProductionTurnsLeft", instead of "getProductionTurnsLeft()", or other arguments (there are four overloads for that function).

I don't see such a line. Adding the address operator is not the answer, since that would just give you a pointer to the function address.

Can you post the bit of code actually there?

As for the complete recompile, that's expected when a project option changes.
 
I haven't done any changes to the source yet, I was just trying to understand it - I spent a lot of time just staring into it.

I will look at the function just to be sure I didn't any accidental changes there.

EDIT: Oh, you were right

Code:
if ((iHurryPopulation * 3) > (getProductionTurnsLeft * 2))

I can't understand how it happened, because I'm quite sure I didn't even open that file. I was focusing on CvPlot and CvGame.

I hope it is the last error, I will reload the source.

Thanks a lot
 
Finally, it passed the compilation. But now the linker shows errors (exactly 403) similiar to these
Code:
Linking...
   Creating library Release/CvGameCoreDLL.lib and object Release/CvGameCoreDLL.exp
CyCity.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CyHallOfFameInterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CyInfoInterface1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CyInfoInterface3.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CyStructsInterface1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvTeam.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvUnit.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvUnitAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvXMLLoadUtilitySet.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvPopupReturn.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvReplayInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvSelectionGroup.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvStructs.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvPlayer.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvPlayerAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvPlot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvPopupInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvGlobals.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvHallOfFameInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvInfos.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvMapGenerator.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvDiploParameters.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvDLLWidgetData.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvGame.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvGameTextMgr.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
_precompile.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
CvArtFileMgr.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvCity.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CvCityAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception@std@@QAE@ABQBD@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CyHallOfFameInterface.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CyInfoInterface1.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CyInfoInterface3.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CyStructsInterface1.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvTeam.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvUnit.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvUnitAI.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvXMLLoadUtilitySet.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvPopupReturn.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvReplayInfo.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvSelectionGroup.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvStructs.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvPlayer.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvPlayerAI.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvPlot.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvPopupInfo.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvGlobals.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvHallOfFameInfo.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvInfos.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvMapGenerator.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvDiploParameters.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvDLLWidgetData.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvGame.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvGameTextMgr.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
_precompile.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvArtFileMgr.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvCity.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CvCityAI.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ)
CyCity.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CyHallOfFameInterface.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CyInfoInterface1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CyInfoInterface3.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CyStructsInterface1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvTeam.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvUnit.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvUnitAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvXMLLoadUtilitySet.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvPopupReturn.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvReplayInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvSelectionGroup.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvStructs.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvPlayer.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvPlayerAI.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvPlot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvPopupInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvGlobals.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvHallOfFameInfo.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvInfos.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvMapGenerator.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvDiploParameters.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvDLLWidgetData.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvGame.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvGameTextMgr.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
_precompile.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UAE@XZ)
CvArtFileMgr.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
CvCity.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall std::exception::~exception(void)" (__imp_??1exception@std@@UAE@XZ)
I reloaded the code completely from the BtS dir.
 
Can't really help you with that one, other than to suggest you make sure you have all the compiler fixes, the proper SDK's installed, and that you rebuild the project from scratch.
 
After some more struggle and several rebuilds I managed to finish the build without errors. But I expected it would generate the CvGameCore.dll and it core and it created only CvGameCoreDLL.exp and lib. What did I wrong? Sry, I have never made a DLL in C++. Thank you.
The project is set to put the DLL in "..\Beyond the Sword\Assets". Look for it there or (better) change the project to place it where you want.
 
Sadly not :(

In the output dir are only these files:
Code:
CvGameCoreDLL.exp
CvGameCoreDLL.lib
CvGameCoreDLL_DEBUG_MEM.pdb

This is a part of my compiler output:
Code:
Linking...
LINK : program database c:\Documents and Settings\mzabsky\Dokumenty\Visual Studio 2008\Projects\CvGameCoreDLL\Build\CvGameCoreDLL_DEBUG_MEM.pdb missing; performing full link
   Creating library .\Build/CvGameCoreDLL.lib and object .\Build/CvGameCoreDLL.exp
Embedding manifest...
Build log was saved at "file://c:\Documents and Settings\mzabsky\Dokumenty\Visual Studio 2008\Projects\CvGameCoreDLL\Debug FxsMemory\BuildLog.htm"
CvGameCoreDLL - 0 error(s), 512 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
I don't understand it :(
 
I don't understand it :(
I don't believe you understood what I wrote.

Under the project options, check Linker->Output File.

The project in the Firaxis-supplied SDK has that set to "..\Beyond the Sword\Assets\CvGameCoreDLL.dll" (or _RELEASE and _DEBUG before the extension, depending on the build configuration).
 
Oww, thanks, I don't know how could I be so stupid.

What are all thes build configurations for? I tried to compile it with the default one (Debug FxsMemory) and the game has immidiately thrown an error, that the boost_python-vc71-mt-1_32.dll cannot be found (but the game started "propertly", it crashed while loading into a game though). With the Release the game crashes in the XML Init phase :(

I still didn't make any changes to the code, the code I'm using comes from the BeyondTheSword/CvGameCoreDLL/.

EDIT: I forgot to say that I deleted the rc file from the project, I shouldn't cause any problems though.
 
What are all thes build configurations for? I tried to compile it with the default one (Debug FxsMemory) and the game has immidiately thrown an error, that the boost_python-vc71-mt-1_32.dll cannot be found (but the game started "propertly", it crashed while loading into a game though). With the Release the game crashes in the XML Init phase :(

EDIT: I forgot to say that I deleted the rc file from the project, I shouldn't cause any problems though.
The game was built with VS2003. There hoops to jump through to get it working with VS2005, which you can find somewhere on these forums. Something similar may help you get it working with VS2008.

You will not be able to get a debug version working. Stick with Release or Final Release.

And get that RC file back.
 
Back
Top Bottom