[SDK] Using Microsoft Visual C++ 2005 Express Edition

Hmm, your makefile looks good to me. Did it create the Final_Release folder? Did it compile all the .cpp files into .obj files into that folder?

It created the folder, yes, but it didn't do the second step. It didn't even review code before having this fatal error. :(
 
It should tell you what it's doing at each step of the way--the command that it is passing to Windows. The create directory commands are hidden (the - at the front of the Final_Release_DIRS line), but the others are not. So we aren't even seeing that it's trying to compile.

You can try issuing the command at the command line. Open cmd.exe, go to the directory containing the makefile, and put the PSDK/bin folder onto your path (the one that contains nmake.exe) and type

nmake Final_Release​

Does it give you anything different?
 
@Cybah
In case you haven't already sorted it, here is a stripped down RevDCM makefile for straight BTS 319 debugging. It compiles on my end fine with BTS319 sources but haven't actually fired it up in the debugger with breakpoints. Haven't checked it with final release either.

Cheers.
 

Attachments

I'd like to try and create a debug DLL.
Where can I download VS 2005 though?
If I follow the link provided in the first post, I only see VS 2008 available for download.
 
I haven't gotten a debug build to actually work yet, but I honestly haven't tried that hard. I can say that I had no trouble getting VS 2008 to work following the same instructions as VS 2005. And since nmake and VC++ 2003 are doing the compilation, it shouldn't make a difference.
 
I used Glider's 3.19 makefile and tried to create a Debug DLL. The compiler gives me the following error message:

1>Boost-1.32.0\include\boost\tuple\detail\tuple_basic.hpp(338) : fatal error C1204: compiler limit : internal structure overflow
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"

I appreciate any help.
 
Which file was it compiling when it failed? I would google for that error and see if there's a switch to cl.exe to increase the debugging symbols space.

I'm able to compile all the files myself, but then the link fails with a ton of symbol lookup errors. :(
 
@EmperorFool
Any luck debugging? I am able to debug revdcm 319 with the same basic makefile as I supplied above for straight bts319, and am using all the tools and instructions based on this thread.
Cheers.
 
@EmperorFool
Any luck debugging? I am able to debug revdcm 319 with the same basic makefile as I supplied above for straight bts319, and am using all the tools and instructions based on this thread.

Yay! I took a look at your makefile to see what I had done wrong. I totally rewrote my makefile to better understand it and clean it up, and in doing so I removed the msvcprtd.lib library for the debug build. D'oh! I am now able to build the DLL and hopefully will be able to attach to it (no time to test that yet).

Thanks! :goodjob:
 
I've got a couple debug DLL related questions.

1)
I added this new AI type for sea colonies which uses the CvUnitAI::AI_seaColonyMove() function. Unfortunately Sea Colony Pods just stay put in the base they're built instead of moving out and do some useful stuff. I'd like to find out why that is, where the CvUnitAI::AI_seaColonyMove() function returns. Unfortunately I can't figure out how to find this out using a debug DLL. I can of course set a breakpoint at CvUnitAI::AI_seaColonyMove(), but that just tells me that the function is being accessed. It doesn't tell me where it returns. Does anyone know how to do this?

2)
Before trying out Microsoft Visual C++ 2008 Express Edition for debugging purposes, I have always used (and am still mainly using) Codeblocks. With that program, as long as you don't change header files, if you only change cpp files and then compile the DLL, it will only spend time recompiling the changed cpp files. If you change a header file, it will recompile all files. To find out if files are changed, it looks at the date stamp.

I can't figure out how it works in Microsoft Visual C++ 2008 Express Edition. Today I tried out the same as I usually do with Codeblocks - simply drop the changed cpp and header files in the project folder - but then Microsoft Visual C++ 2008 Express Edition gives an error whe trying to compile. So this program seems to use another method than Codeblocks to figure out what files are changed and which it needs to recompile. Does anyone know what this method is? Am I forced to always 'Rebuild Solution' (which recompiles all files) instead of merely 'Build Solution'?

3)
I end the turn using the debug DLL. At the start of my next turn... all citizens of of all cities of all players (both me and AIs) have been turned into Citizen specialists instead of working the fields.

When playing with an assert (not debug) DLL, I have also noticed that the AI city governor simply does not place its free specialists - you can still place them manually though. When you then click on the city tile within the city screen (which lets the AI decide plot worker placement) the free specialists disappear again.

It appears that using these assert and debug DLLs causes some parts of the AI to malfunction/not function.

Has anyone else experience this before, or does anyone know what's causing this?

Thanks!
 
I can of course set a breakpoint at CvUnitAI::AI_seaColonyMove(), but that just tells me that the function is being accessed. It doesn't tell me where it returns.

Are you trying to figure out who called that function? If so, you can do two things. First, you should be able to see the call chain (also called a stack trace) of each function along the way to your function. Second, if you use the Step Out button VS will execute the function up til the point it returns to the caller.

I can't figure out how it works in Microsoft Visual C++ 2008 Express Edition.

You need to use a makefile with VS because VS cannot compile the code itself. Technically you can make it compile the code, but then Civ4 won't work with that DLL. So you use a makefile and VC++ 2003 to do the compilation. Makefiles work exactly as you have described, but you must tell nmake (the make program) which files depend on which other files (.cpp files depend on .h files because they #include them).

The makefiles posted on this site all suffer from a problem in that they only list the main .h file named for the .cpp file. They don't include the other .h files #included nor do they account for transitive inclusion. This is why sometimes after modifying a .h like CvEnums.h which is included by many .cpp files you have to force it to recompile everything. You may be experiencing this effect.

I end the turn using the debug DLL. At the start of my next turn... all citizens of of all cities of all players (both me and AIs) have been turned into Citizen specialists instead of working the fields. . . .

Debug and Assert DLLs should not affect how the game functions. The only difference with an Assert DLL is that you are given the option to ignore error conditions and see what happens if you continue running the program instead of killing it. The Debug DLL should have no difference whatsoever. Did you fully recompile these DLLs after making changes?
 
can someone help me? i used the latest makefile in this thread bts3.19.
it looks like the prob is wd d makefile.. it is on bold red

1>------ Rebuild All started: Project: CvGameCoreDLL, Configuration: Final_Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> del Debug\CvGameCoreDLL.dll Debug\CvArea.obj Debug\CvArtFileMgr.obj Debug\CvCity.obj Debug\CvCityAI.obj Debug\CvDeal.obj Debug\CvDiploParameters.obj Debug\CvDLLButtonPopup.obj Debug\CvDLLEntity.obj Debug\CvDLLPython.obj Debug\CvDLLPythonEvents.obj Debug\CvDLLTranslator.obj Debug\CvDLLWidgetData.obj Debug\CvEventReporter.obj Debug\CvFractal.obj Debug\CvGame.obj Debug\CvGameAI.obj Debug\CvGameCoreDLL.obj Debug\CvGameCoreUtils.obj Debug\CvGameInterface.obj Debug\CvGameTextMgr.obj Debug\CvGlobals.obj Debug\CvHallOfFameInfo.obj Debug\CvInfoWater.obj Debug\CvInfos.obj Debug\CvInitCore.obj Debug\CvMap.obj Debug\CvMapGenerator.obj Debug\CvMessageControl.obj Debug\CvMessageData.obj Debug\CvPlayer.obj Debug\CvPlayerAI.obj Debug\CvPlot.obj Debug\CvPlotGroup.obj Debug\CvPopupInfo.obj Debug\CvPopupReturn.obj Debug\CvRandom.obj Debug\CvReplayInfo.obj Debug\CvReplayMessage.obj Debug\CvSelectionGroup.obj Debug\CvSelectionGroupAI.obj Debug\CvStatistics.obj Debug\CvStructs.obj Debug\CvTalkingHeadMessage.obj Debug\CvTeam.obj Debug\CvTeamAI.obj Debug\CvUnit.obj Debug\CvUnitAI.obj Debug\CvXMLLoadUtility.obj Debug\CvXMLLoadUtilityGet.obj Debug\CvXMLLoadUtilityInit.obj Debug\CvXMLLoadUtilitySet.obj Debug\CyArea.obj Debug\CyAreaInterface.obj Debug\CyArgsList.obj Debug\CyArtFileMgr.obj Debug\CyArtFileMgrInterface.obj Debug\CyCity.obj Debug\CyCityInterface1.obj Debug\CyDeal.obj Debug\CyEnumsInterface.obj Debug\CyGame.obj Debug\CyGameCoreUtils.obj Debug\CyGameCoreUtilsInterface.obj Debug\CyGameInterface.obj Debug\CyGameTextMgr.obj Debug\CyGameTextMgrInterface.obj Debug\CyGlobalContext.obj Debug\CyGlobalContextInterface1.obj Debug\CyGlobalContextInterface2.obj Debug\CyGlobalContextInterface3.obj Debug\CyGlobalContextInterface4.obj Debug\CyHallOfFameInfo.obj Debug\CyHallOfFameInterface.obj Debug\CyInfoInterface1.obj Debug\CyInfoInterface2.obj Debug\CyInfoInterface3.obj Debug\CyMap.obj Debug\CyMapGenerator.obj Debug\CyMapGeneratorInterface.obj Debug\CyMapInterface.obj Debug\CyMessageControl.obj Debug\CyMessageControlInterface.obj Debug\CyPlayer.obj Debug\CyPlayerInterface1.obj Debug\CyPlayerInterface2.obj Debug\CyPlot.obj Debug\CyPlotInterface1.obj Debug\CyRandomInterface.obj Debug\CyReplayInfo.obj Debug\CySelectionGroup.obj Debug\CySelectionGroupInterface.obj Debug\CyStructsInterface1.obj Debug\CyTeam.obj Debug\CyTeamInterface.obj Debug\CyUnit.obj Debug\CyUnitInterface1.obj Debug\FAssert.obj Debug\FDialogTemplate.obj Debug\_precompile.obj Debug\CvGameCoreDLL.lib Debug\CvGameCoreDLL.def Debug\CvGameCoreDLL.exp Debug\CvGameCoreDLL.pdb Debug\CvGameCoreDLL.ilk
1>The system cannot find the file specified.
1>NMAKE : fatal error U1077: 'del' : return code '0x1'
1>Stop.

1>Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> "C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo /MD /Gd /G7 /GR /O2 /W3 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DFINAL_RELEASE /IBoost-1.32.0/include /IPython24/include /I"C:/Program Files/Microsoft Visual C++ Toolkit 2003/include" /I"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include" /c CvPlayer.cpp /FoFinal_Release/CvPlayer.obj
1>CvPlayer.cpp
1> "C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/link.exe" /dll /nologo /LIBPATH:Python24/libs /LIBPATH:boost-1.32.0/libs/ /LIBPATH:"C:/Program Files/Microsoft Visual C++ Toolkit 2003/lib" /LIBPATH:"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib" /out:Final_Release\CvGameCoreDLL.dll boost_python-vc71-mt-1_32.lib winmm.lib user32.lib Final_Release\CvArea.obj Final_Release\CvArtFileMgr.obj Final_Release\CvCity.obj Final_Release\CvCityAI.obj Final_Release\CvDeal.obj Final_Release\CvDiploParameters.obj Final_Release\CvDLLButtonPopup.obj Final_Release\CvDLLEntity.obj Final_Release\CvDLLPython.obj Final_Release\CvDLLPythonEvents.obj Final_Release\CvDLLTranslator.obj Final_Release\CvDLLWidgetData.obj Final_Release\CvEventReporter.obj Final_Release\CvFractal.obj Final_Release\CvGame.obj Final_Release\CvGameAI.obj Final_Release\CvGameCoreDLL.obj Final_Release\CvGameCoreUtils.obj Final_Release\CvGameInterface.obj Final_Release\CvGameTextMgr.obj Final_Release\CvGlobals.obj Final_Release\CvHallOfFameInfo.obj Final_Release\CvInfoWater.obj Final_Release\CvInfos.obj Final_Release\CvInitCore.obj Final_Release\CvMap.obj Final_Release\CvMapGenerator.obj Final_Release\CvMessageControl.obj Final_Release\CvMessageData.obj Final_Release\CvPlayer.obj Final_Release\CvPlayerAI.obj Final_Release\CvPlot.obj Final_Release\CvPlotGroup.obj Final_Release\CvPopupInfo.obj Final_Release\CvPopupReturn.obj Final_Release\CvRandom.obj Final_Release\CvReplayInfo.obj Final_Release\CvReplayMessage.obj Final_Release\CvSelectionGroup.obj Final_Release\CvSelectionGroupAI.obj Final_Release\CvStatistics.obj Final_Release\CvStructs.obj Final_Release\CvTalkingHeadMessage.obj Final_Release\CvTeam.obj Final_Release\CvTeamAI.obj Final_Release\CvUnit.obj Final_Release\CvUnitAI.obj Final_Release\CvXMLLoadUtility.obj Final_Release\CvXMLLoadUtilityGet.obj Final_Release\CvXMLLoadUtilityInit.obj Final_Release\CvXMLLoadUtilitySet.obj Final_Release\CyArea.obj Final_Release\CyAreaInterface.obj Final_Release\CyArgsList.obj Final_Release\CyArtFileMgr.obj Final_Release\CyArtFileMgrInterface.obj Final_Release\CyCity.obj Final_Release\CyCityInterface1.obj Final_Release\CyDeal.obj Final_Release\CyEnumsInterface.obj Final_Release\CyGame.obj Final_Release\CyGameCoreUtils.obj Final_Release\CyGameCoreUtilsInterface.obj Final_Release\CyGameInterface.obj Final_Release\CyGameTextMgr.obj Final_Release\CyGameTextMgrInterface.obj Final_Release\CyGlobalContext.obj Final_Release\CyGlobalContextInterface1.obj Final_Release\CyGlobalContextInterface2.obj Final_Release\CyGlobalContextInterface3.obj Final_Release\CyGlobalContextInterface4.obj Final_Release\CyHallOfFameInfo.obj Final_Release\CyHallOfFameInterface.obj Final_Release\CyInfoInterface1.obj Final_Release\CyInfoInterface2.obj Final_Release\CyInfoInterface3.obj Final_Release\CyMap.obj Final_Release\CyMapGenerator.obj Final_Release\CyMapGeneratorInterface.obj Final_Release\CyMapInterface.obj Final_Release\CyMessageControl.obj Final_Release\CyMessageControlInterface.obj Final_Release\CyPlayer.obj Final_Release\CyPlayerInterface1.obj Final_Release\CyPlayerInterface2.obj Final_Release\CyPlot.obj Final_Release\CyPlotInterface1.obj Final_Release\CyRandomInterface.obj Final_Release\CyReplayInfo.obj Final_Release\CySelectionGroup.obj Final_Release\CySelectionGroupInterface.obj Final_Release\CyStructsInterface1.obj Final_Release\CyTeam.obj Final_Release\CyTeamInterface.obj Final_Release\CyUnit.obj Final_Release\CyUnitInterface1.obj Final_Release\FAssert.obj Final_Release\FDialogTemplate.obj Final_Release\_precompile.obj /debug /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF
1> Creating library Final_Release\CvGameCoreDLL.lib and object Final_Release\CvGameCoreDLL.exp
1>LINK : warning LNK4089: all references to 'KERNEL32.dll' discarded by /OPT:REF
1>The system cannot find the path specified.
1> 0 file(s) copied.
1>Build log was saved at "file://d:\Games\civ4 files\civ4 BTS changes\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 1 error(s), 1 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
 
Need help with these errors...

I am able to compile fine, but after a few edits and additions, I get this:

Code:
1> "C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo  /MD /Gd /G7 /GR /O2 /W3 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DFINAL_RELEASE   /IBoost-1.32.0/include /IPython24/include /I"C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Users\Martin\Compiler stuff\Microsoft Platform SDK/Include" /c CvPlayer.cpp /FoFinal_Release/CvPlayer.obj
1>CvPlayer.cpp
1> "C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo  /MD /Gd /G7 /GR /O2 /W3 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DFINAL_RELEASE   /IBoost-1.32.0/include /IPython24/include /I"C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Users\Martin\Compiler stuff\Microsoft Platform SDK/Include" /c CvPlayerAI.cpp /FoFinal_Release/CvPlayerAI.obj
1>CvPlayerAI.cpp
1> "C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo  /MD /Gd /G7 /GR /O2 /W3 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DFINAL_RELEASE   /IBoost-1.32.0/include /IPython24/include /I"C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Users\Martin\Compiler stuff\Microsoft Platform SDK/Include" /c CvPlot.cpp /FoFinal_Release/CvPlot.obj
1>CvPlot.cpp
[B]1>C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003\include\excpt.h(36) : error C2144: syntax error : 'int' should be preceded by ';'
1>C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003\include\excpt.h(36) : error C2501: 'f' : missing storage-class or type specifiers
1>C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003\include\ostream(604) : fatal error C1903: unable to recover from previous error(s); stopping compilation[/B]
1>NMAKE : fatal error U1077: '"C:\Users\Martin\Compiler stuff\Microsoft Visual C++ Toolkit 2003/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:\Users\Martin\Compiler stuff\New builds\VC2008 projekter\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 5 error(s), 1 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
 
Thanks for the tip. :) I made a comparison of CvPlot.cpp, and a single, small 'f' was at the very top of the file, in front of two //. No doubt from me hitting Fn+f instead of CTRL+f to do a search, on my laptop. :D
 
Back
Top Bottom