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

Each include file is used in almost all the hundred source files, once you process the transitive references.

That is very sad. Most of the work I do on BULL is in the .cpp files, and any header file changes tend to be adding a new function for my use. Thus I can typically get away with recompiling just the .cpp files I'm changing.

Since I'm only using my own mfMaker.py script to generate dependencies, this works fine and catches the rare case what I do requires a little more recompilation. You may want to give that limited dependency thing a shot. Just know that if you add new constants to CvEnums.h you need a full rebuild.
 
Program Files x86 is the folder to which all non-Windows-essential type stuff is sent in Vista.
 
I had noticed this when I moved off of Codeblocks, that I had to manually select to full recompile when it was needed, but I was on codeblocks long enough to notice that if you do a header in the Cv___ files, you recompile ALL Cv____ files, and if you do a header in Cy___ files, you do CvInfos and all Cy___ files. I never traced the dependancies around, but I kept that as the rule of thumb for myself: Change a header, lose 20 minutes.

Kinda nice to hear that it CAN be done better NORMALLY, but in this case, not much.
 
Thanks, but that was the less important of my two points. You appear to be using 64-bit link libraries which are getting rejected.

Well, I'm running 64-bit Vista, so...:crazyeye:..man this is weird. I'm using the exact libraries provided in Refar's guide.
 
I'm not sure everybody reads this thread, but does anybody know of a success in compiling the sdk using 64-bit vista? I am sure the sdk is 32-bit, and all the tools and libraries are 32-bit, so I am sure it is possible. I suspect somehow one of the libraries being linked in your setup is a 64-bit library, which is causing the problem, but I am not sure how to prove it (or avoid it.)
 
Currently my compiler is set up for 32-bit compilation - I've redownloaded VS and set it for 64-bit compilation; it shoudl work now..
 
Perhaps I did not explain very well. Civ is a 32-bit game. If you produce a 64-bit dll, civ won't be able to use it. The goal is to compile a 32-bit dll, using only 32-bit libraries. I guess that somewhere, your compiler is picking up one 64-bit library when it should not be. I don't think that setting up everything for 64-bit compilation will work; I think the goal is to find what 64-bit object is being used unexpectedly, and replace it with the right 32-bit object. Sadly, I do not know enough about 64-bit vista to tell where all it may be finding 64-bit libraries.
 
Currently my compiler is set up for 32-bit compilation - I've redownloaded VS and set it for 64-bit compilation; it shoudl work now..

VS should not be doing any of the compilation or linking. This is where Visual C++ Toolkit 2003 and the PSDK come in. VS should only kick off the compilation by calling the PSDK's nmake.exe program and passing it the Makefile and build target (Final_Release or Debug).

I would try compiling from the command line to remove VS from the picture. Open up a cmd.exe shell, change to the location of your Makefile, add VC++ and PSDK's bin folders onto your path, and type

nmake Final_Release​

To add a path to the system path for cmd.exe (temporarily), type this:

path %path%;"C:\Program Files...path-to-folder...\bin"​

What happens when you do this?
 
So, I would type:

1) cd C:\Users\[name]\Desktop\CvGameCoreDLL
2) path %path%;"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin"
3) path %path%;"C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin"
4) nmake Final_Release

TIme to test, guess.

Edit: nope, same errors...
 
davidlallen said:
I carefully compared your build and link lines to mine. There is one difference. One of my link options is:

/LIBPATH:"C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib"

Yours is:

/LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v6.0/Lib/x64"

I am sorry for repeating myself, but I feel this is the most likely cause of the problem, and you do not seem to have investigated this. The "x64" directory contains 64-bit libraries, which you do not want. In the makefile, this is controlled by the "PSDK=" line right at the top of the file. I am not sure where the "x64" part of your link line is coming from. The line in my makefile is:

PSDK=C:/Program Files/Microsoft SDKs/Windows/v6.0A

Then the "/lib" part gets added on later in the makefile. You can check this by searching for "PSDK" in the makefile. If you can understand why the "x64" is appended to your line and fix it, then rebuild, it may fix the problem. Or at least, if that is not the problem I have no idea what is.
 
I am sorry for repeating myself, but I feel this is the most likely cause of the problem, and you do not seem to have investigated this. The "x64" directory contains 64-bit libraries, which you do not want. In the makefile, this is controlled by the "PSDK=" line right at the top of the file. I am not sure where the "x64" part of your link line is coming from. The line in my makefile is:

PSDK=C:/Program Files/Microsoft SDKs/Windows/v6.0A

Then the "/lib" part gets added on later in the makefile. You can check this by searching for "PSDK" in the makefile. If you can understand why the "x64" is appended to your line and fix it, then rebuild, it may fix the problem. Or at least, if that is not the problem I have no idea what is.

And I'm sorry for being a fool and missing it. :( That would do it: compilation of an unmodded DLL spit out CvGameCoreDLL.dll. :goodjob:

I'm using the same Makefile with my modded DLL, and it appears to be working great.

Thanks a lot, davidlallen and EmperorFool! :D
 
Is there a tutorial about adding new source files to the makefile anywhere? :D
 
You need to do two things, but you must do them for each build target (Final_Release, Debug, etc) in your makefile. In the snippets below, replace <target> with Final_Release or Debug or whatever. Replace <file> with the name of the file without the .cpp extension, for example CvBugOptions.

1. Create a build rule for the .obj file.

Code:
<target>/<file>.obj: <file>.cpp <headers...>
	$(CPP) /nologo $(<target>_CFLAGS) $(<target>_INCS) /c <file>.cpp /Fo<target>/<file>.obj

2. Add the .obj file to the list of objects used to link.

Code:
<target>_OBJS = <target>/_precompile.obj <target>/CvArea.obj ... [B]<target>/<file>.obj[/B]
 
Is there a way to figure out what the return code on an nmake error means?

I keep getting
Code:
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/link.exe"' : return code '0x460'

whenever I try to compile. I've followed refar's guide to the letter, and am attempting to compile an unaltered cpp using the makefile provided in the guide download. Does that one still work, or am I messing up something else?
 
I don't think Refar's makefile was updated to 3.19, and some new files were added there. Otherwise, try Google for error codes. What are the lines before that. Usually there's a more informative message before the error code.
 
I tried again with the updated makefile, but now have this warning and cannot find the dll file.

Spoiler :
Code:
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> "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 Platform SDK for Windows Server/Include" /c CvDLLPythonEvents.cpp /FoFinal_Release/CvDLLPythonEvents.obj
1>CvDLLPythonEvents.cpp
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 Platform SDK for Windows Server/Include" /c CvDLLTranslator.cpp /FoFinal_Release/CvDLLTranslator.obj
1>CvDLLTranslator.cpp
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 Platform SDK for Windows Server/Include" /c CvEventReporter.cpp /FoFinal_Release/CvEventReporter.obj
1>CvEventReporter.cpp
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 Platform SDK for Windows Server/Include" /c CvMessageControl.cpp /FoFinal_Release/CvMessageControl.obj
1>CvMessageControl.cpp
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 Platform SDK for Windows Server/Include" /c CvMessageData.cpp /FoFinal_Release/CvMessageData.obj
1>CvMessageData.cpp
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 Platform SDK for Windows Server/Include" /c CvStatistics.cpp /FoFinal_Release/CvStatistics.obj
1>CvStatistics.cpp
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 Platform SDK for Windows Server/Include" /c CyMessageControl.cpp /FoFinal_Release/CyMessageControl.obj
1>CyMessageControl.cpp
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 Platform SDK for Windows Server/Include" /c CyMessageControlInterface.cpp /FoFinal_Release/CyMessageControlInterface.obj
1>CyMessageControlInterface.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 Platform SDK for Windows Server/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://c:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Natural Culture\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
 
This means you have a linked DLL! It should be in the folder with the same name as your target, i.e. Final_Release or Debug. All you need to do now is fix the path in the makefile to point to your BTS installation folder and it will copy it over the one in BTS's Assets folder. Look for "copy" in the makefile.

WARNING! Back up your original DLL first!
 
I'm following Refar's guide for using the SDK, and when I try to build solution (with no changes, just the original bts files), it gives me these errors:
Code:
1>NMAKE : fatal error U1077: '"C:/Program Files (x86)/Microsoft Visual C++ Toolkit 2003/bin/cl.exe' : return code '0x1'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
I'm using the bts3.19 makefile.
Does anyone know what these errors are caused by and how to fix them?
 
Back
Top Bottom