A simple guide to compiling the DLL

The principles of using VS, compiling and debugging will be the same, and briefly going through the civ4 col forums it seems that it uses the same MS version and platform SDK, so I guess it will work.
But you'll have to use Col's C++ source files and probably change the file list in the project itself (even though it doesn't really matter for the compilation).

So short answer: Maybe. try and let me know. good luck.
 
Hello Asaf. :)

I've been fighting with VS 2010 for a few days now (either won't compile, or else won't link. :() I usually don't have any problems but Visual Studio just does not seem to want to let go of a previous project. :mad: I can't get it to acknowledge that my code and makefile is different...

Anyway, I downloaded your project and make file so that I could start from scratch, and it's pretty much working - except that I'm getting a link error on the CxImage files. I'm not sure exactly where to put them to work with your make file. Could you please 'splain it to this dumb ol' girl? ;)

Thanks,
LM
 
I doubt anyone on the BUG/BAT team is dumb ;)

I'm guessing CxImage.cpp is not in the same folder as the other source files.
The makefile (based on DannyDaemonic's one) compiles and links all *.cpp files in its folder.
If there are source files which are not there, you can either copy them to this folder or add them manually to the makefile.

If, for example, CxImage.cpp is in a subfolder called CxImage, you can add something like that (after the "#### Auto SOURCES/OBJS ####" section):

Code:
SOURCES=$(SOURCES) CxImage\CxImage.cpp
Debug_OBJS=$(Debug_OBJS) Debug\CxImage.obj
Release_OBJS=$(Release_OBJS) Debug\CxImage.obj

Debug\CxImage.obj: $(CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /FoDebug\CxImage.obj /c CxImage\CxImage.cpp
Release\CxImage.obj: $(CPP) /nologo $(Release_CFLAGS) $(Release_INCS) /FoRelease\CxImage.obj /c CxImage\CxImage.cpp
 
I doubt anyone on the BUG/BAT team is dumb ;)
:lol:
You'd be surprised. ;)

I'm guessing CxImage.cpp is not in the same folder as the other source files.
The makefile (based on DannyDaemonic's one) compiles and links all *.cpp files in its folder.
If there are source files which are not there, you can either copy them to this folder or add them manually to the makefile.

If, for example, CxImage.cpp is in a subfolder called CxImage, you can add something like that (after the "#### Auto SOURCES/OBJS ####" section):

Code:
SOURCES=$(SOURCES) CxImage\CxImage.cpp
Debug_OBJS=$(Debug_OBJS) Debug\CxImage.obj
Release_OBJS=$(Release_OBJS) Debug\CxImage.obj

Debug\CxImage.obj: $(CPP) /nologo $(Debug_CFLAGS) $(Debug_INCS) /FoDebug\CxImage.obj /c CxImage\CxImage.cpp
Release\CxImage.obj: $(CPP) /nologo $(Release_CFLAGS) $(Release_INCS) /FoRelease\CxImage.obj /c CxImage\CxImage.cpp
Thanks for the tip. I'm using EF's compiled CxImage.lib, though, and VS can't find the files, no matter where I put them. It also refuses to use the Platform SDK. Instead it keeps using the Windows v7.0A SDK, where it used to be pointed, even though I made a new project.

This is really driving me crazy. I can't seem to get rid of some old make file information, and that's only IF it decides to use the correct make file at all. I've copied all of the source files to another folder and created a new project several times, but VC++ insists on using old search directories. The Intellisense is somewhat broken as well. I have no idea why this won't work. It used to work flawlessly. Maybe it's time for a reinstall... :(
 
If it's a lib you can add it to the PROJECT_LIBS define in the makefile.
Code:
PROJECT_LIBS=/LIBPATH:Python24/libs /LIBPATH:boost-1.32.0/libs/ boost_python-vc71-mt-1_32.lib [B]/LIBPATH:<Whatever_Path_it_is_in>/CxImage.lib[/B]

When you use a makefile project, the folders pointed to by VS are ignored (as is the entire VS build process), unless VS2010 changes it somehow... Googling seems to indicate that it should be fine.

So are you saying your project uses the wrong makefile? VS runs NMAKE in the same folder as the project file, and looks for the makefile in that folder. But if you're not sure, you can change the build command (in Project->Properties) to:
Code:
nmake /NOLOGO /K [B]/f <makefile path>[/B] Debug

Does the makefile you're trying to use point to the correct platform SDK?

As for the intellisense - try deleting the intellisense database file (up until VS2008 it was .ncb, I think in VS2010 it's .sdf) in the solution file's folder (do it after you close VS and reopen it).
It will cause a rebuild of the intellisense DB (at least it did in older versions).
 
If it's a lib you can add it to the PROJECT_LIBS define in the makefile.
Code:
PROJECT_LIBS=/LIBPATH:Python24/libs /LIBPATH:boost-1.32.0/libs/ boost_python-vc71-mt-1_32.lib [B]/LIBPATH:<Whatever_Path_it_is_in>/CxImage.lib[/B]
When you use a makefile project, the folders pointed to by VS are ignored (as is the entire VS build process), unless VS2010 changes it somehow... Googling seems to indicate that it should be fine.

So are you saying your project uses the wrong makefile? VS runs NMAKE in the same folder as the project file, and looks for the makefile in that folder. But if you're not sure, you can change the build command (in Project->Properties) to:
Code:
nmake /NOLOGO /K [B]/f <makefile path>[/B] Debug
Does the makefile you're trying to use point to the correct platform SDK?

As for the intellisense - try deleting the intellisense database file (up until VS2008 it was .ncb, I think in VS2010 it's .sdf) in the solution file's folder (do it after you close VS and reopen it).
It will cause a rebuild of the intellisense DB (at least it did in older versions).
Thanks again for the pointers. I'll try them out.

I'm not really sure why, but things aren't behaving correctly. Oh well, I'll keep at it and let you know. :)
 
Update

It worked! It worked! Thank you Asaf! :goodjob:
 
I'm getting this error:
Creating temporary file "C:\Users\Ethan\AppData\Local\Temp\BAT00000734483792.bat" with contents
[
@echo off

nmake /NOLOGO /K Debug

if errorlevel 1 goto VCReportError

goto VCEnd

:VCReportError

echo Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"

exit 1

:VCEnd
]
Creating command line "C:\Users\Ethan\AppData\Local\Temp\BAT00000734483792.bat"
Any Help?
 
What you've posted isn't an error, but a print out of the temporary script created to run the makefile. This script contains the command to print an error message if needed, and that's what you see there.

Was the DLL created? If not, can you post the full output in the output window?
 
Great tutorial, thanks very much for this.

I am coming back to the game after considerable time off, and missing the whole BtS experience. I have written mods for Civ 4 Warlords 2.13 and one of my mods is down to playtesting and debugging stage. What I want to do is finish up the mod for Warlords 2.13 and then port it to BtS 3.19.

Asaf, I have a few questions:

1) I used to run a Windows XP machine with the full version of VS .NET 2003 to work on my Civ 4 mods. However I currently run a Windows 7 64-bit machine. I have tried running VS 2003 in Windows XP mode on my Win 7 rig and it is not happy. Can I use VS 2008 to code and compile, and also debug (by attaching to a running process)? Should I use VS 2010?

2) Is this tutorial specific to BtS, in particular the project and makefile? What changes should I make to work with my Warlords 2.13 DLL?

-c
 
1) I used to run a Windows XP machine with the full version of VS .NET 2003 to work on my Civ 4 mods. However I currently run a Windows 7 64-bit machine. I have tried running VS 2003 in Windows XP mode on my Win 7 rig and it is not happy. Can I use VS 2008 to code and compile, and also debug (by attaching to a running process)? Should I use VS 2010?

Yes, you can use VS 2008 to code, compile and debug, but you'd still need the VC++ 2003 platform (a make file is used, so technically VS2008 doesn't do the compilation). Just follow the tutorial and you'll have all the components you need to use VS2008.

I guess you can use VS2010 (haven't tried myself), although I heard rumors that some of the functionality was removed in VS 2010 express :dunno:. If you have professional (or team, or whatever they call it), you should really be fine.

2) Is this tutorial specific to BtS, in particular the project and makefile? What changes should I make to work with my Warlords 2.13 DLL?

The makefile is not specific to BTS, since it just compiles all .cpp files in its folder.
The project contains all the BTS files, which might be different than Warlords, but it only matters for searching, and you can easily remove the files and add Warlords'.

As for the changes - although I played Warlords, I've never modded for it. But I understand that the exposed code is very different. Many modding features were enabled in the C++ code (such as the ability to change the XML parsing code, I believe).

Unless you really want your mod to work for Warlords as well, I suggest you go straight to merging your code to BTS.
 
These are the errors I am getting after tring to compile the newest bug bat ai

Assert Failed

File: CvXMLLoadUtilitySet.cpp
Line: 1295
Expression: bSuccess
Message:

It looks like it suceeded?
 
These are the errors I am getting after tring to compile the newest bug bat ai

Assert Failed

File: CvXMLLoadUtilitySet.cpp
Line: 1295
Expression: bSuccess
Message:

It looks like it suceeded?
The build succeeded, but you are missing some XML tags somewhere...
 
Hi Asaf,
How do recompile after i make a minor change to the C++ of another mod. It seems that nothing i do works. Is there a different process if one wants to make minor changes to a mod like rhyes and fall. If you want i can provide u with more details on the errors.

Thanks for ur help
 
The C++ files you work on (no matter the source) should be in the same folder as your vcproj and makefile.
Assuming they are, then whenever you build the project all the modified C++ files in that folder are compiled again.

If modifying them gave you errors, then it means you are modifying the correct files.
If you post the errors here I can try and help you solve them :)
 
Asaf Thanks for helping out.

Before I give u the errors, i want to be sure if im even doing the right thing. I made minor changes to CvPlayers.cpp and CvRhyes.cpp and then I copied everything in the mods CvGameCoreDLL folder and then pasted it to the CvGameCoreDLL folder i downloaded from ur tutorial. While pasting it asked me that there were two CvGameCoreDLL files and if i wanted to replace the original with the one from the RFC MOd, i did'nt replace it and kept the original that came with the download. After i was done I went on Microsoft Visual and built the solution but i got the following errors.

1>CvPlayer.cpp(5343) : error C2065: 'Persia' : undeclared identifier
1>CvPlayer.cpp(5343) : error C2228: left of '.isReborn' must have class/struct/union type
1>c1xx : fatal error C1083: Cannot open source file: 'CvRhyes.cpp': Permission denied
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
 
I'm not sure what file you're referring to by "CvGameCoreDLL file". What's its extension? Is it the vcproj file? if this is the case, you should indeed not override, but use the one you downloaded from the tutorial.

In case of conflict between files from RFC and files from BTS: Makefile, CvGameCoreDLL.vcproj, CvGameCoreDLL.sln and fastdep.exe you should use from this tutorial. All other files, if exist in both folders, use RFC's.

I also suggest that you first try merging RFC into the BTS source folder and compile without your modified source files (create a backup of them somewhere). After you successfully compile RFC, then try making your changes and see if they compile.
 
Back
Top Bottom