Installing and using the SDK

Kael

Deity
Joined
May 6, 2002
Messages
17,401
Location
Ohio
Note:
This thread is somewhat out-of-date.
You can find assistance here:
How to Install the SDK (modiki link)
-or-
Refar's Makefile/Instructions BTS 3.17 SDK / Debugging



If you have Visual Studio 2003 (Visual C++ 7) you should be able to load the SDK up directly. If not (and you would like a free option) you can use the following process to get codeblocks to allow you to modify and compile the SDK.

A huge thanks to DaveMcW for developing this process. I spent a very sad weekend staring at the SDK without any ability to do anything with it until he provided this writeup.

You can download the SDK from: http://www.2kgames.com/civ4/downloads.htm

Before you start this make sure to turn off the Read Only flag on all of the files in the SDK.

DaveMcW said:
Here is a free method of building the DLL. (Thanks to Ogre Wiki for many of the details.)

I had trouble getting some of the debug options to compile, so I turned them off.


1: Download the VC++ Toolkit 2003 and install it.

2: Grab the 3 multithreaded library files and put them in C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib.

msvcrt.lib and msvcrtd.lib and msvcprt.lib (Read Ogre Wiki to see where this comes from).

3: Download the Platform SDK. You can also use internet explorer to install it automatically (recommended).

4: Download the latest CodeBlocks "without compiler" and install it.

5: The first time you install CodeBlocks, you will be shown a list of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default. Press OK.

6: Go to Settings->Compiler in the CodeBlocks menu. Click the "Directories" tab and add the the following directories to the compiler tab (changing to account for where you installed the packages):

Code:
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Include
C:\Program Files\Microsoft Platform SDK\Include

In the Directories/Linker tab add the following directories:

Code:
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Lib
C:\Program Files\Microsoft Platform SDK\Lib


7: Open \CvGameCoreDLL\CvGameCoreDLL.vcproj in CodeBlocks.

8: Go to Project->Build options->Final Release.

On the "Compiler Flags" tab, uncheck "Produce debugging symbols [/Zi]".


On the "Other options" tab, change EHsc to /EHsc


On the "Linker" tab, add a new link library called user32

Also on the Linker tab, delete the linker option "/pdb:Final Release\CvGameCoreDLL.pdb" and press OK.


9: Change the "Build target" drop-down to Final Release.

10: File->Save project. This creates a CodeBlocks project (.cbp) that you can open in the future.

11: Build->Build. When the compiler finishes, you will have \..\Assets\CvGameCoreDLL.dll !

For some examples of things that can be done easily with the SDK check out: http://forums.civfanatics.com/showthread.php?t=166934

And for a bit more indepth example for you programmer types check out: http://forums.civfanatics.com/showthread.php?t=166935

Here is an update from sgerner on some updates that are required for the BtS SDK:

Gedrin, by default the BTS project has the /Zi (Produce debugging symbols) option enabled. You want to turn that off to get past the compiler limit error:
- under: Project --> Build options...
- in the tab for: Final Release Win 32 --> Compiler Settings --> Other Options
- remove: /Zi

Other deviations from the tutorial that I had to make to get everything to build properly include the following:
1) remove CvGameCoreDLL.rc from the project (you must have already done this though to get this far):
- in the Projects workspace tab go to the directory (Resources) and right click on the CvGameCoreDLL.rc file. Select "Remove from project"
2) remove CvGameCoreLL_DEBUG.pdb from linker:
- under: Projects --> Build options...
- in the tab for: Final Release Win 32 --> Linker Settings --> Other Linker Options
- remove: /pdb:Final Debug Win32\CvGameCoreDLL_DEBUG.pdb




- Kael
 
>.> wow... complex........ I'm scroo-ed lol
 
Is there a particular reason why these other files are neccesary. I mean can you not just load the project file into VC++? I fail to see the neccesity for the codeblocks and lib files. :confused:
 
Agent 009 said:
Is there a particular reason why these other files are neccesary. I mean can you not just load the project file into VC++? I fail to see the neccesity for the codeblocks and lib files. :confused:

DaveMcW said:
Here is a free method of building the DLL.
VC++ isn't free is it? But ofcourse, if you can use it, no need for this.
 
Sticky This Thread!!!
 
snarko said:
VC++ isn't free is it? But ofcourse, if you can use it, no need for this.


Yeah I missed that part... I just skimmed through his post to see what he was saying was needed.

I was talking to my Dad about it and he was uncertain about it as well and when I mentioned Kael said Microsoft Visual C++ Toolkit 2003, he wasn't certain what I was referring to. You see, we have both Borland C++ and Visual C++ 6.

I doubt Borland will work however, I am uncertain if VC++ 6 will work or if this Toolkit Kael mentioned is some sort of extention that can be added to it.

If VC++ 6 won't work then I guess I'll have to settle for Kael's free option. :p
 
Yeah, I tried to compile origionally with Visual C++ 2005 couldn't get it to work (Firaxis built it with Visual C++ 2003). If you have VC++ 2003 you are all set, but thats a little difficult to find nowdays. Hence this option.
 
Kael said:
Yeah, I tried to compile origionally with Visual C++ 2005 couldn't get it to work (Firaxis built it with Visual C++ 2003). If you have VC++ 2003 you are all set, but thats a little difficult to find nowdays. Hence this option.


ahh I see... but will this still work in VC++ 6?
 
Hmmm, having slight trouble with the "Platform SDK" - the webpage linked is a dead page with a link to another page which claims that the file has been updated, and I can't seem to find the update on the MS website though...
 
What do I do!? Do I continue working on units, or do I sink my teeth into the SDK, or do I finally take the time and play the actual game which I haven't touched in a month. Damn my mortal body and it's need to sleep! :wallbash: :D
 
Agent 009 said:
ahh I see... but will this still work in VC++ 6?

I wasn't able to get it to work with VC++ 6 or 8. Apparently it was compiled with Visual Stuido 2003 (not visual C++ 2003 as I said).

So you may be able to get it to work if you have Visual Studio 2003 or VC++ 7. Otherwise you will probably need to use the method I described.
 
I was surprised to see that the "SDK" was really just the complete source code. Pretty cool actually. How many companies would give the source to a comercial app? But I was expecting at least a reference or a readme, maybe even an app. I suppose once I put this into VC++, I'll have a better understand of what's going on.

Can't wait to break CIV!
 
The Great Apple said:
Hmmm, having slight trouble with the "Platform SDK" - the webpage linked is a dead page with a link to another page which claims that the file has been updated, and I can't seem to find the update on the MS website though...

K, I moved the file over to a server I control.
 
Thanks Kael. I'll get on that ASAP... got a small problem with my mod now as a direct result of the patch so I need to fix it first before attempting anything with the SDK.

Rabbit, you might want to check yours as well. Mine lost all of the menu text and I haven't the slightest clue how to fix it.
 
I loaded the CvGameCoreDLL.vcproj up in Visual Studio dot Net (2003) and compiled the CvGameCoreDLL_RELEASE.dll without any problem. I was a little scared when I saw Keal's post about needing all of those files. I guess that's the way you do it if you don't have VisualStudio.Net.

Now that I'm looking at the files I realize it's been about 5 years since I did an yserious C++ programming. This is going to take awhile. :yuck:

Roger Bacon
 
Agent 009 said:
Thanks Kael. I'll get on that ASAP... got a small problem with my mod now as a direct result of the patch so I need to fix it first before attempting anything with the SDK.

Rabbit, you might want to check yours as well. Mine lost all of the menu text and I haven't the slightest clue how to fix it.
Thanks for the heads up, I'll check it.
 
RogerBacon said:
I loaded the CvGameCoreDLL.vcproj up in Visual Studio dot Net (2003) and compiled the CvGameCoreDLL_RELEASE.dll without any problem.
Roger Bacon

I think you have to go to "Project->CvGameCoreDll properties", then "Linker", and then edit the output file to be "../Assets/CvGameCoreDLL.dll" in order to get a usable dll. At least that's what I've been doing.
 
Top Bottom