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

Ok I bet my problem and of some other is coming from some special setup.

So first what I'm using:
- XP Pro with SP3
- Civilization complete with the 3.17 patch applied.
- At this point I test it only with the BtS CoreGame dll, not yet with a mod (I wanted to be sure the mod wasn't involved in the problems, I advise do this too until you make it works once).
- About the service "Services Terminal Server" its setup is set to manual but something had launch it at some points, perhaps MVC.

I followed closely the pdf guide made by Refar. That adds to my computer:
- Microsoft Platform SDK
- Microsoft Visual C++ Toolkit 2003
- MVC2008 which installed: Microsoft Visual Studio 9.0
During its installation I checked 2 options but I remember only one relative to Database.

With the unmodified makefile provided by Refar:
- I succeed to build the Release. And the build dll working well.
- I also did a successful Debug build.

But when I was Running BtS with the debug dll:
- I got an error of a missing msvcp71d.dll. I found one on the net and put it in BtS folder.
- Then I got an error of a missing msvcr71d.dll. I found one on the net and put it in BtS folder.
- The I got a Python error, with Python messages activated in ini file it was saying that the load of CvGameInterface was unsuccessful.

Quote that at this point, it's not clear where MVC2008 could be involved as only SDK folders are involved and only MVC2003 commands are issued during builds.

I have multiple possible tracks at this point but I dig only one, the makefile.
So I did the following changes to the makefile:
1 - Changed boost_python-vc71-mt-gd-1_32.lib to boost_python-vc71-mt-1_32.lib in the line Debug_LIBS=
2 - Removed /D_DEBUG from the lines Debug_CFLAGS= and Debug_SAFE_CFLAGS=.

I join bellow a modified makefile that I'm using. The point 1 is definitely linked with the problem of *d.dll. And the point 2 is involved by the change of the point 1.

At this point I could use the debug dll with BtS and get no error. But for debugging I think it's not enough, I had also to do some setup in MVC2008 :
- Select the solution configuration "Debug" at the top (not Final_Release).
- Select the project, right click on it, select "Properties".
- Expand "Configuration properties" in the left.
- Select "Debugging"
- Then fill the fields on right as this:
- Command, it's the path to the application BtS: C:\Games\Civ4Complete\Beyond the Sword\Civ4BeyondSword.exe
- Command arguments, let it empty.
- Working directory, check your shortcut to BtS, with Civilization complete it's: C:\Games\Civ4Complete
- Attach: Yes
- Debugger type: Mixed
- Environment, let it empty.
- Merge Environment: Yes
(I know the snapshot is missing!) EDIT: I joined one bellow.

Once this setup is done:
- Backup the dll in the Assets folder in BtS.
- Copy the dll generated from the debug folder to the Assets folder in BtS, let here a copy of the files. It's not useful to also copy the pdb file, MVC2008 will be able to find it where it has generated it.
- Launch Bts (through windows or MVC2008) and start a game.
- In menu "Debug" select "Start Debugging"
- Open CvUnit.cpp and set a breakpoint in the method getExperience().
- Click next turn in the game and the game should stop and you should be in the breakpoint.
- If it works the red bullet of the breakpoint becomes an arrow and in bottom left you can inspect objects and variables.

Before to try the debugging be sure that the Release version of the dll is working fine. Also when you have generated the debug dll you can test it just by launching BtS without to attempt debugging, it should works.
 

Attachments

  • Makefile.zip
    5.6 KB · Views: 131
  • Debug MVC2008 setup.PNG
    Debug MVC2008 setup.PNG
    18.8 KB · Views: 224
About the errors coming from some missing *d.dll and the python error with the *d.dll, I have some other possible track than changing the Makefile:

The first track, I have no evidence but many little hints. I highly suspect that the Microsoft Platform SDK version is the problem, eventually linked with the OS setup used:
I'm using: "Microsoft Platform SDK" (I think it's with SP1, not sure).
When some other are using: "Microsoft Platform SDK for Windows Server 2003 R2".

The problem is that if you follow the guide you'll install the version I use and find on the net an install or update to the other version isn't easy.

The best would be if someone could provide an installer of "Microsoft Platform SDK for Windows Server 2003 R2". If not, perhaps only provides its "Include" and "Lib" folders.

Another possibility is to search everywhere if there's no msvcp71d.dll and msvcr71d.dll. Eventually they'll be different versions of those I found on the net, but I doubt a little of this track, I think I would have find those versions on the net, ha well who know. :)

There's also one suspect detail, the version of msvcp71d.dll and msvcp71.dll are the same but not for msvcr71d.dll and msvcr71.dll.

A last track would be to update Boost Python, but that could be a problem if the newer version is not compatible with the current version used by BtS. Additionally there's no evidence that this will solve the problem but a post that had the same *d.dll problems (not with civ4) and solved it in some way, eventually by updating it and then perhaps updated the boost included. The guy had also installed "Microsoft Platform SDK for Windows Server 2003 R2" once the bug solved, but not sure before.

EDIT:
Well the track about using "Microsoft Platform SDK for Windows Server 2003 R2" seems wrong.
I found an ISO image that installed me the SDK with this same folder name and it didn't solved the *d.dll problems with the original makefile.
For reference anyway a link: http://downloads.zdnet.co.uk/0,1000000375,39329568s,00.htm
It allows download a file named: 5.2.3790.2075.51.PlatformSDK_Svr2003R2_rtm.img
That I could open with some application like MagicISO. And the install installed me "Microsoft Platform SDK for Windows Server 2003 R2".
 
@Fagan and Refar
Thanks for making some good progress good people. Further than what I had achieved. Be careful not to drive yourself nuts in the process. Microsoft can do this sometimes.
Yes nuts but the Makefile was enough to make me nuts no help required from MS! :D Well MS could be involved somewhere but I have no evidence, eventually it's just I didn't installed the right version or the right version for my OS.

I quote you got very similar problems than me. Perhaps you could try the change I did to see if they work for your setup and also I'd be curious to know if you have installed:
- "Microsoft Platform SDK"
- Or "Microsoft Platform SDK for Windows Server 2003 R2"
 
I have the Server PSDK one.
 
@Fagan
Firstly a big thanks for the work of submitting your finds onto the forum. :goodjob: Really appreciate the effort!!!

I will have to go through your information with a fine tooth comb so that I don't miss anything and to ensure it's relevant with my setup. I will report back here with any news.

Thanks again, and it's people like you that prove to me that civ is more than a game.
Cheers.
 
I have the Server PSDK one.
I finally found an install of the server version and this didn't solved my problem with some *d.dll. So it doesn't seems to be the cause.
@Fagan
Firstly a big thanks for the work of submitting your finds onto the forum. :goodjob: Really appreciate the effort!!!

I will have to go through your information with a fine tooth comb so that I don't miss anything and to ensure it's relevant with my setup. I will report back here with any news.

Thanks again, and it's people like you that prove to me that civ is more than a game.
Cheers.
The Refar clean makefile and guide help a lot. I hope my little contribution will help you.
 
^Refar, thx for the pdf file and makefile. Setting up the release is a breeze with your instructions.

^Fagan,debugging i have the same problem as you have, missing that msvcp71d.dll file. But i compiled the cvGamecore.dll using vc2005++ though i have vc2008++ installed.
Any chance uninstalling vc2008++'ll help? I installed Microsoft Platform SDK btw.
Edit: Your solution with the modified makefile seems to work beautifully though, i only had to change the makefile btw, debug was enabled after that as far as i can see.
 
Cool that it works for you. For the debug enabling it's quite possible that the additional setup I described for MVC2008 isn't required.

Myself even after the debug version of the dll was working fine I had some problems to have the debug and only attach seems not work, I had to do "start debugging". But I didn't investigate a lot once it worked for me. I didn't double check so I just know that the setup I described is working (for me at least) but eventually not required or not fully required.
 
If it's ok with you i will update the PDF attaching your instructions as appendix, so the most current stand of kowledge is covered there.
I have a link to the thread there right now, but i would like to have all available information inside there, for people who want to print it or domething...
 
If it's ok with you i will update the PDF attaching your instructions as appendix, so the most current stand of kowledge is covered there.
I have a link to the thread there right now, but i would like to have all available information inside there, for people who want to print it or domething...
That's fine you can integrate any information you want in this pdf. I agree it's much better to have one pdf that summarize all.
 
So I did the following changes to the makefile:
1 - Changed boost_python-vc71-mt-gd-1_32.lib to boost_python-vc71-mt-1_32.lib in the line Debug_LIBS=
:goodjob: For what it's worth, this was the only thing I needed to add to Refar's pdf instructions (27.08.2008 v.2) to get debugging working for me. (I had the "can't find MSVCP71D.dll" error originally.) The other Makefile change Fagan noted didn't appear necessary in my case and I did not download any extra libraries beyond the ones listed in the PDF instructions.

My environment is:
IDE: Microsoft Visual C++ 2005 Express (set to run as Administrator)
Compiler: Microsoft Visual C++ Toolkit 2003
PSDK: Microsoft Platform SDK for Windows Server 2003 R2
OS: Vista Ultimate SP1 (32bit)
Civ: BTS 3.13 (Normally run 3.17 but I rolled back to check some stuff out)
 
@Dresdon
Great stuff and happy that you got it going. Thanks for the environment details and report back. Really handy to have some positive confirmations. In the near future I will attempt to repeat your efforts on Vista Ultimate 64bit and perhaps VC 2008.
Cheers.
 
<-- going nuts, trying to debug in VS 2008

I think I am finally going to just breakdown and buy Visual Studio .NET 2003 and to hell with all this craziness.

We know for sure that all versions of Civ 4 were written in VS 2003, up to and including BtS 3.17 ?
 
<-- going nuts, trying to debug in VS 2008

I think I am finally going to just breakdown and buy Visual Studio .NET 2003 and to hell with all this craziness.

We know for sure that all versions of Civ 4 were written in VS 2003, up to and including BtS 3.17 ?

Know how you feel. Where would you buy it? I'm still going to give VS2008 a go at some point for debugging, but could very easily come to the same conclusion as you!
Cheers.
 
It might be the OS rather than the IDE.
VS .NET 2003 @ Vista don't let me Debug too, while it works fine @ XP.
 
It might be the OS rather than the IDE.
VS .NET 2003 @ Vista don't let me Debug too, while it works fine @ XP.

Ok great info. Thanks Refar. Probably if I lock myself in a monastry with a Vista computer and prayed night and day, it might be possible to make it debug too, but XP will have to be the truth and the light.
:goodjob:
Cheers.
 
Well, Vista is a horrible operating system. Any gaming enthusiast who is not running XP is on the wrong path to start with.

VS 2003 is easily available, just search around on the net.

Why in God's name Microsoft thought it was OK to break compatibility is beyond me, isn't that one of the major blunders of the century?

But also, why didn't Firaxis save all of us a ton of grief by simply porting Civ 4 to VS 2005 or VS 2008 along the way? They are normally highly supportive of the modding community. Sure it would have cost them a little money, but not much comparatively speaking, and for the wizards at Firaxis it would have been a snap.
 
Correct me if I'm wrong, but I don't believe ANYONE has successfully debugged using VS 2008.
 
Top Bottom