SDK - how to resolve some compilation errors

Joined
Feb 6, 2006
Messages
795
These are some errors that happened to me just yesterday. Since I think there should be quite common, I show how I resolved them.

First of all: I use makefile to compile, but some things should be appliable for codeblocks too.
This is the guide I've followed: http://forums.civfanatics.com/showthread.php?t=196283

This is the output when compilation errors occur:
Spoiler :

1>------ Build started: Project: CvGameCoreDLL, Configuration: Final_Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Building Precompiled Header
1> cl /O2 /D "NDEBUG" /D "Final_Release" /MD /GR /Yc"CvGameCoreDLL.h" /Fp"Final_Release/CvGameCoreDLL.pch" /Fo"Final_Release/" /Fd"Final_Release/vc70.pdb" /Zi /I "Boost-1.32.0\include" /I "Python24\include" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /W3 /c /Gd /TP _precompile.cpp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>_precompile.cpp
1>Unknown compiler version - please run the configure tests and report the results
1>c:\sdk\CvString.h(44) : warning C4996: 'swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\swprintf.inl(85) : see declaration of 'swprintf'
1>c:\sdk\CvString.h(220) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\sdk\CvString.h(243) : warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(215) : see declaration of 'stricmp'
1>c:\sdk\CvString.h(244) : warning C4996: 'strnicmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(217) : see declaration of 'strnicmp'
1>c:\sdk\CvString.h(316) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_vsnprintf'
1>c:\sdk\CvString.h(359) : warning C4996: '_vsnwprintf': This function or variable may be unsafe. Consider using _vsnwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(483) : see declaration of '_vsnwprintf'
1>c:\sdk\FProfiler.h(26) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h(74) : see declaration of 'strcpy'
1> cl /O2 /D "NDEBUG" /D "Final_Release" /MD /GR /Yu"CvGameCoreDLL.h" /Fp"Final_Release/CvGameCoreDLL.pch" /Fo"Final_Release/" /Fd"Final_Release/vc70.pdb" /Zi /I "Boost-1.32.0\include" /I "Python24\include" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /W3 /c /Gd /TP .\CvArtFileMgr.cpp .\CyGame.cpp .\CyDeal.cpp .\CyCity.cpp .\CyUnitInterface1.cpp .\CyUnit.cpp .\CyTeamInterface.cpp .\CyTeam.cpp .\CyStructsInterface1.cpp .\CySelectionGroupInterface.cpp .\CySelectionGroup.cpp .\CyReplayInfo.cpp .\CyRandomInterface.cpp .\CyPlotInterface1.cpp .\CyPlot.cpp .\CyPlayerInterface2.cpp .\CyPlayerInterface1.cpp .\CyPlayer.cpp .\CyMapInterface.cpp .\CyMapGeneratorInterface.cpp .\CyMapGenerator.cpp .\CyMap.cpp .\CyInfoInterface3.cpp .\CyInfoInterface2.cpp .\CyInfoInterface1.cpp .\CyHallOfFameInterface.cpp .\CyHallOfFameInfo.cpp .\CyGlobalContextInterface4.cpp .\CyGlobalContextInterface3.cpp .\CyGlobalContextInterface2.cpp .\CyGlobalContextInterface1.cpp .\CyGlobalContext.cpp .\CyGameTextMgrInterface.cpp .\CyGameTextMgr.cpp .\CyGameInterface.cpp .\CyGameCoreUtilsInterface.cpp .\CyGameCoreUtils.cpp .\CyEnumsInterface.cpp .\CyCityInterface1.cpp .\CyArtFileMgrInterface.cpp .\CyArtFileMgr.cpp .\CyAreaInterface.cpp .\CyArea.cpp .\CyArgsList.cpp .\FDialogTemplate.cpp .\FAssert.cpp .\CvXMLLoadUtilitySet.cpp .\CvXMLLoadUtilityInit.cpp .\CvXMLLoadUtilityGet.cpp .\CvXMLLoadUtility.cpp .\CvUnitAI.cpp .\CvUnit.cpp .\CvTeamAI.cpp .\CvTeam.cpp .\CvTalkingHeadMessage.cpp .\CvStructs.cpp .\CvSelectionGroupAI.cpp .\CvSelectionGroup.cpp .\CvReplayMessage.cpp .\CvReplayInfo.cpp .\CvRandom.cpp .\CvPopupReturn.cpp .\CvPopupInfo.cpp .\CvPlotGroup.cpp .\CvPlot.cpp .\CvPlayerAI.cpp .\CvPlayer.cpp .\CvMapGenerator.cpp .\CvMap.cpp .\CvInitCore.cpp .\CvInfoWater.cpp .\CvInfos.cpp .\CvHallOfFameInfo.cpp .\CvGlobals.cpp .\CvGameTextMgr.cpp .\CvGameCoreUtils.cpp .\CvGameCoreDLL.cpp .\CvGameAI.cpp .\CvGame.cpp .\CvFractal.cpp .\CvDLLWidgetData.cpp .\CvDLLPython.cpp .\CvDLLEntity.cpp .\CvDLLButtonPopup.cpp .\CvDiploParameters.cpp .\CvDeal.cpp .\CvCityAI.cpp .\CvCity.cpp .\CvArea.cpp .\CvGameInterface.cpp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>CvArtFileMgr.cpp
....
....
....
1>.\CvUnitAI.cpp(8921) : error C2065: 'iI' : undeclared identifier
......
1>.\CvTeam.cpp(2490) : error C2668: 'pow' : ambiguous call to overloaded function
...
...
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\sdk\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 4 error(s), 515 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



There are two hints:

1-
In the first lines, you read
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
and
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86

2-
You can see a lot of references to the folder
C:\Program Files\Microsoft Visual Studio 9.0\VC

This means that the Visual Studio 2008 C++ compiler is used, instead of the Visual C++ Toolkit 2003 one. The newer compiler is not totally compatible with the SDK code, so the compilation fails. If you use the old one (2003), it succeeds.

One thing that you can do is renamen the wrong c++ compiler, thus forcing the process to use the compiler you want.
The "wrong" compiler is probably located in the folder
C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\
and its name is "cl.exe". Rename it to "cl_.exe".
Now, the compilation should succeeds. This is the expected output.

Spoiler :

1>------ Build started: Project: CvGameCoreDLL, Configuration: Final_Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Building Precompiled Header
1> cl /O2 /D "NDEBUG" /D "FINAL_RELEASE" /MD /GR /Yc"CvGameCoreDLL.h" /Fp"Final/CvGameCoreDLL.pch" /Fo"Final/" /Fd"Final/vc70.pdb" /Zi /I "Boost-1.32.0\include" /I "Python24\include" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /W3 /c /Gd /TP _precompile.cpp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
1>Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
1>_precompile.cpp
1> cl /O2 /D "NDEBUG" /D "FINAL_RELEASE" /MD /GR /Yu"CvGameCoreDLL.h" /Fp"Final/CvGameCoreDLL.pch" /Fo"Final/" /Fd"Final/vc70.pdb" /Zi /I "Boost-1.32.0\include" /I "Python24\include" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /W3 /c /Gd /TP .\CvArtFileMgr.cpp .\CyGame.cpp .\CyDeal.cpp .\CyCity.cpp .\CyUnitInterface1.cpp .\CyUnit.cpp .\CyTeamInterface.cpp .\CyTeam.cpp .\CyStructsInterface1.cpp .\CySelectionGroupInterface.cpp .\CySelectionGroup.cpp .\CyReplayInfo.cpp .\CyRandomInterface.cpp .\CyPlotInterface1.cpp .\CyPlot.cpp .\CyPlayerInterface2.cpp .\CyPlayerInterface1.cpp .\CyPlayer.cpp .\CyMapInterface.cpp .\CyMapGeneratorInterface.cpp .\CyMapGenerator.cpp .\CyMap.cpp .\CyInfoInterface3.cpp .\CyInfoInterface2.cpp .\CyInfoInterface1.cpp .\CyHallOfFameInterface.cpp .\CyHallOfFameInfo.cpp .\CyGlobalContextInterface4.cpp .\CyGlobalContextInterface3.cpp .\CyGlobalContextInterface2.cpp .\CyGlobalContextInterface1.cpp .\CyGlobalContext.cpp .\CyGameTextMgrInterface.cpp .\CyGameTextMgr.cpp .\CyGameInterface.cpp .\CyGameCoreUtilsInterface.cpp .\CyGameCoreUtils.cpp .\CyEnumsInterface.cpp .\CyCityInterface1.cpp .\CyArtFileMgrInterface.cpp .\CyArtFileMgr.cpp .\CyAreaInterface.cpp .\CyArea.cpp .\CyArgsList.cpp .\FDialogTemplate.cpp .\FAssert.cpp .\CvXMLLoadUtilitySet.cpp .\CvXMLLoadUtilityInit.cpp .\CvXMLLoadUtilityGet.cpp .\CvXMLLoadUtility.cpp .\CvUnitAI.cpp .\CvUnit.cpp .\CvTeamAI.cpp .\CvTeam.cpp .\CvTalkingHeadMessage.cpp .\CvStructs.cpp .\CvSelectionGroupAI.cpp .\CvSelectionGroup.cpp .\CvReplayMessage.cpp .\CvReplayInfo.cpp .\CvRandom.cpp .\CvPopupReturn.cpp .\CvPopupInfo.cpp .\CvPlotGroup.cpp .\CvPlot.cpp .\CvPlayerAI.cpp .\CvPlayer.cpp .\CvMapGenerator.cpp .\CvMap.cpp .\CvInitCore.cpp .\CvInfoWater.cpp .\CvInfos.cpp .\CvHallOfFameInfo.cpp .\CvGlobals.cpp .\CvGameTextMgr.cpp .\CvGameCoreUtils.cpp .\CvGameCoreDLL.cpp .\CvGameAI.cpp .\CvGame.cpp .\CvFractal.cpp .\CvDLLWidgetData.cpp .\CvDLLPython.cpp .\CvDLLEntity.cpp .\CvDLLButtonPopup.cpp .\CvDiploParameters.cpp .\CvDeal.cpp .\CvCityAI.cpp .\CvCity.cpp .\CvArea.cpp .\CvGameInterface.cpp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
1>Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
1>CvArtFileMgr.cpp
1>CyGame.cpp
1>CyDeal.cpp
1>CyCity.cpp
1>CyUnitInterface1.cpp
1>CyUnit.cpp
1>CyTeamInterface.cpp
1>CyTeam.cpp
1>CyStructsInterface1.cpp
1>CySelectionGroupInterface.cpp
1>CySelectionGroup.cpp
1>CyReplayInfo.cpp
1>CyRandomInterface.cpp
1>CyPlotInterface1.cpp
1>CyPlot.cpp
1>CyPlayerInterface2.cpp
1>CyPlayerInterface1.cpp
1>CyPlayer.cpp
...
...
...
1>CyMapInterface.cpp
1>CyMapGeneratorInterface.cpp
1>Generating Code...
1>Compiling...
1>CyMapGenerator.cpp
1>CvArea.cpp
1>CvGameInterface.cpp
1>Generating Code...
1> link /OUT:"./Final/CvGameCoreDLL.dll" /INCREMENTAL:NO /PDB:"Final/CvGameCoreDLL.pdb" /OPT:REF /OPT:ICF /IMPLIB:"Final/CvGameCoreDLL.lib" /LIBPATH:"Python24\libs" /LIBPATH:"boost-1.32.0\libs" /DLL /DEBUG /SUBSYSTEM:WINDOWS /MACHINE:X86 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Boost-1.32.0\libs\boost_python-vc71-mt-1_32.lib" Final/CvArtFileMgr.obj Final/CyGame.obj Final/CyDeal.obj Final/CyCity.obj Final/CyUnitInterface1.obj Final/CyUnit.obj Final/CyTeamInterface.obj Final/CyTeam.obj Final/CyStructsInterface1.obj Final/CySelectionGroupInterface.obj Final/CySelectionGroup.obj Final/CyReplayInfo.obj Final/CyRandomInterface.obj Final/CyPlotInterface1.obj Final/CyPlot.obj Final/CyPlayerInterface2.obj Final/CyPlayerInterface1.obj Final/CyPlayer.obj Final/CyMapInterface.obj Final/CyMapGeneratorInterface.obj Final/CyMapGenerator.obj Final/CyMap.obj Final/CyInfoInterface3.obj Final/CyInfoInterface2.obj Final/CyInfoInterface1.obj Final/CyHallOfFameInterface.obj Final/CyHallOfFameInfo.obj Final/CyGlobalContextInterface4.obj Final/CyGlobalContextInterface3.obj Final/CyGlobalContextInterface2.obj Final/CyGlobalContextInterface1.obj Final/CyGlobalContext.obj Final/CyGameTextMgrInterface.obj Final/CyGameTextMgr.obj Final/CyGameInterface.obj Final/CyGameCoreUtilsInterface.obj Final/CyGameCoreUtils.obj Final/CyEnumsInterface.obj Final/CyCityInterface1.obj Final/CyArtFileMgrInterface.obj Final/CyArtFileMgr.obj Final/CyAreaInterface.obj Final/CyArea.obj Final/CyArgsList.obj Final/FDialogTemplate.obj Final/FAssert.obj Final/CvXMLLoadUtilitySet.obj Final/CvXMLLoadUtilityInit.obj Final/CvXMLLoadUtilityGet.obj Final/CvXMLLoadUtility.obj Final/CvUnitAI.obj Final/CvUnit.obj Final/CvTeamAI.obj Final/CvTeam.obj Final/CvTalkingHeadMessage.obj Final/CvStructs.obj Final/CvSelectionGroupAI.obj Final/CvSelectionGroup.obj Final/CvReplayMessage.obj Final/CvReplayInfo.obj Final/CvRandom.obj Final/CvPopupReturn.obj Final/CvPopupInfo.obj Final/CvPlotGroup.obj Final/CvPlot.obj Final/CvPlayerAI.obj Final/CvPlayer.obj Final/CvMapGenerator.obj Final/CvMap.obj Final/CvInitCore.obj Final/CvInfoWater.obj Final/CvInfos.obj Final/CvHallOfFameInfo.obj Final/CvGlobals.obj Final/CvGameTextMgr.obj Final/CvGameCoreUtils.obj Final/CvGameCoreDLL.obj Final/CvGameAI.obj Final/CvGame.obj Final/CvFractal.obj Final/CvDLLWidgetData.obj Final/CvDLLPython.obj Final/CvDLLEntity.obj Final/CvDLLButtonPopup.obj Final/CvDiploParameters.obj Final/CvDeal.obj Final/CvCityAI.obj Final/CvCity.obj Final/CvArea.obj Final/CvGameInterface.obj Final/_precompile.obj
1>Microsoft (R) Incremental Linker Version 7.10.3077
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> Creating library Final/CvGameCoreDLL.lib and object Final/CvGameCoreDLL.exp
1>LINK : warning LNK4089: all references to 'KERNEL32.dll' discarded by /OPT:REF
1> echo ./Final/CvGameCoreDLL.dll built successfully
1>./Final/CvGameCoreDLL.dll built successfully
1>Build log was saved at "file://d:\SDK\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

 
Top Bottom