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

@Glider

Try changing the /MDd switch to /MD and link to normal lib. This should work. You don't need to walk through the runtime library anyway. Also you may like to add an option for full debug info. I think the debug build target in the makefile doesn't actually include such option. Look into the VS help to find out which option you need. I am sorry that I can't be more helpful. I am on vacation and away from my main PC.
 
Enjoy the holidays and thanks! The "symptoms" re-compiled here are these:
1) compile with /MD and link to normal lib. Debug symbol database built but debugging does not work because the IDE complains that the symbols for this breakpoint have not been loaded (final release)

So instead, try to debug using /MDd in experiment within other build contexts.
2) Compiles but will not link because not all the debug dll's are present

So instead:
3) will now try to find a way to make /MD work (again) via other possible command line options. However it feels like trying to plug multiple holes in a sinking boat with only one cork.

Cheers.
 
I think I'm starting to get the hang of this but I'm still having way too many problems. I'm trying to mod the RFC ver. 1181 DLL and I'm having some trouble. I get an error that states that "it doesn't know how to make 'final'". Otherwise I follwed the steps exactly, can someone please help.
 
@MAM
If you are using VC 2008, I can confirm that if you follow the steps on page one and use the make file supplied by Echard on page 7, you should be able to compile just fine. Suggest you go back to basics and see if you can compile the 3.17 SDK first up. Then try your own mods.
Cheers.
 
@MAM
Successfully compiling a big C++ project like BTS is a complex process that is being undertaken. If you have any problems continue posting but get as specific with the problem as you can get. Makes diagnosis simpler.
Cheers.
 
Now I get this error which I've been getting for a while.

------ Build started: Project: CvGameCoreDLL, Configuration: Final_Release Win32 ------
Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1052: file 'Final_Release' not found
Stop.
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Brians Projects\CvGameCoreDLL\Final_Release\BuildLog.htm"
CvGameCoreDLL - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm using Elcard's Makefile and I don't know what it could be? Help!
 
There must have been something else - it says "2 error(s)" down there.

I am not 100% familiar with the Visual C compilers "rant etiquette", but i think that indicates previous code errors. It's usually best to start fixing from the top, as later errors could be follow-upson a earlier one.
 
No luck Jdog. As per a couple of posts above this one, the problem appears to be that not all the 2003 libraries required for debugging have been included on page one of this forum. The three libraries supplied there are fine for compiling but there are more libraries needed for debugging. Particularly any library *d.lib in the VC 2003 lib directory. The "d" signifies for debugging. The exact required files are:

1) Compile and link with the /MDd option uses MSVCPRTD.LIB (debug equivalent compile lib)

However that library is not supplied on page one of this forum. In fact there may even be more files needed which is why it would be nice to basically just zip up the entire 2003 lib directory and upload, or just the files *d.lib in the VC 2003 directory.

It is a bit sad that debugging is not possible yet on VC 2005/2008 for us people who want to work on civ without buying VC 2003 on ebay or via dubious means.

Any help would be appreciated for us debugging fanatics.
Cheers.

I totally agree, it is so 1979 to work on code without a debugger. The fact of the matter is that Microsoft, in their infinite wisdom, didn't see fit to make VS2005+ backwards-compatible. That is an unforgivable sin.

On another note, I found myself actually playing a game of BtS the other day when my ISP crashed. So that's what it takes! I dug out my old mods and had a look at Kael's excellent BtS modder's guide. Got the old juices flowing again...
 
Here's the full buildlog.

Command Lines Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\BAT00000149201204.bat" with contents
[
@echo off

nmake Final_Release

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:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\BAT00000149201204.bat"
Output Window Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1052: file 'Final_Release' not found
Stop.
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
Results Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Brians Projects\CvGameCoreDLL\Final_Release\BuildLog.htm"
CvGameCoreDLL - 2 error(s), 0 warning(s)
 
Same problem over and over, I'm 100% my makefile is in the right spot. Help Me! I've got everything over and done for an awesome mini-mod but the .dll just won't compile.

Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@MaM
Sorry I can't help. My only thought is whether you have renamed the active solution configuration to Final_Release as per instructions (not the project but the configuration). If it's not done, the makefile won't know what to compile. It can be a bit deceiving in VS2008. The active configuration is still referred to as "Release" but when you go to the configuration manager you see that the active configuration "solution" is called "Final_Release" (if all is well).
Cheers.
 
I've decided to give this a go myself but I'm very confused...I followed the instructions word by word and nothing...


1>------ Build 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> "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/Include" /c CvArea.cpp /FoFinal_Release/CvArea.obj
1>CvArea.cpp
1>CvArea.cpp(3) : fatal error C1083: Cannot open include file: 'CvGameCoreDLL.h': No such file or directory
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"
1>Build log was saved at "file://c:\Users\Shawn\Desktop\Mods\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
I got the debugging working guys.
With the free VC++ 2005 Express, installed and set up as described in the first post.

DaveMcW explains the problem over in the "other compiling thread" (http://forums.civfanatics.com/showthread.php?t=166933 - Page 7). In short, due to a limitation of free compiler, some files could not be compiled with the /Zi flag needed to build the debugging tables. Dave suggested splitting those files up, to go around the limitation, but it had no follow up...

I went the other way, disabled the "evil" /Zi flag on those files only (Dave provided the list in his post). There is not much to debug in them anyway.
Compiled the rest with /Zi, as needed for Debugging.

Modified Jean_Elcards makefile to do so.

So:
Set up everything as described in the first post.
Compile everything using the attached makefile (I invoked nmake from the console, but "Build" should work as well.)
Run the game using the created .Dll (Windowed works best)
In VC++ 2005 Express, with the project loaded, choose Debug->Attach to Process...
Choose Civ4....



I am a comlete Makefile-goof so the thing is a terrible mess, would be really nice if someone could check it, and maybe make it look human...
But it does work.

Edit: makefile reuploaded 2 posts below.
 
Thanks Refar for the info will give it a go. Being a modder without being able to debug is like trying to fix a car engine with a plastic fork and spoon.

EDIT:
Tried the makefile and changed the paths to VC and the SDK to suit. Now it complains that the PDB file doesn't match the image or something along those lines. In other words the symbols for CvGameCoreDLL.dll don't get loaded. It did used to load the symbols for the DLL with the original makefile but didn't debug. If I change the name of the PDB in the makefile to match the name of CvGameCoreDLL.dll that doesn't work. If I manually try to load the symool database that doesn't work either. Hmmm...

Perhaps I better retrograde back to VC++2005 and forget VC++2008.

Question:
I've got very limited download capacity with my ISP. How big is the download for VC2005 and the PSDK all up?

Cheers.
 
There was a CnP mistake in the makefile... It did not seem to be a problem on VC++2005, but maybe it is on 2008 :crazyeye:

Line 96:
Code:
Final_Release_LDFLAGS= $(Final_Release_PROJECT_LDFLAGS) /debug /NODEFAULTLIB:msvcprtd.lib [COLOR="DarkRed"]/pdb:Final_Release\CvGameCoreDLL[U][B]_DEBUG[/B][/U].pdb [/COLOR]/INCREMENTAL /SUBSYSTEM:WINDOWS $(Final_Release_GLOBAL_LDFLAGS)

while all the other files are called just CvGameCoreDLL.dll etc. I changed it to /pdb:Final_Release\CvGameCoreDLL.pdb now, so all the files match.

Fixed, recompiled and retired it - it still works the same for me (It did work with the wrong filename as well... perhaps VC++2005 is less picky about file naming than your version...).
"Fixed" Makefile attached.

You might also want to try to load the project in the IDE before attaching the Debugger, so the sources are present.

You might need to check it your toolset is expecting the files to be in a certain location - maybe Final_Release subfolder does not work well for debugging with your IDE.

Also note - the debugger log when you attach it lists multiple items - all but CVGameCoreDLL.dll will say "No Symbols Loaded" - ne need to bother about those - we are only interested in our own build.

Code:
'Civ4BeyondSword.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll', No symbols loaded.
'Civ4BeyondSword.exe': Loaded 'C:\WINDOWS\system32\userenv.dll', No symbols loaded.
'Civ4BeyondSword.exe': Loaded 'E:\Games\CivIV\Beyond the Sword\Assets\CvGameCoreDLL.dll', Symbols loaded.
'Civ4BeyondSword.exe': Loaded 'C:\WINDOWS\system32\msxml3.dll', No symbols loaded.


In other words the symbols for CvGameCoreDLL.dll don't get loaded. It did used to load the symbols for the DLL with the original makefile but didn't debug.
I am not sure what you mean here. If it attached to the process and loaded the symbols, you should be able to debug it.
I did not tried all the possibilities of course, so there still might be something not working.
But i can set breackpoints, step trough them and access memory objects (like give some XP to a unit)
 
I am not sure what you mean here. If it attached to the process and loaded the symbols, you should be able to debug it.

Thanks for the efforts Refar. I've tried the new makefile and the pdb symbol database name matches the dll now no problem. Compiling is still perfect. However it looks as if there is something very wrong with my "environment" because sometimes the symbols for CvGameCoreDLL get loaded and sometimes not. No matter what, it is never able to debug.

You know, this could be the reality of my problem:
Vistax64 + VC2008. It could simply be something to do with "administrator credentials and privileges" under Vista or something to do with VC2008 or even both!

My situation is that I'll have to move to an XP box and try this all again. However does anyone know how big the total download is for VC++2005 PSDK under XP? I'm starting to run low on ISP data again.

Cheers and thanks for your time and effort, the makefile is great and will try again on another box. :goodjob:
 
I made a final (so i hope) change to the makefile.

Cleaned it up, redefined targets, so it can make Final_Release and Debug builds now.
Also made clean work with del insted of rm, as i don't have rm at hand.
Included modified (only slightly) instructions from the first post with a few sceenshots as PDF.
On a sidenote - while i couldn't find a way to compile a single file from withgin the VS2005 IDE, you can invoke nmake from console (Tools->VS Command Prompt) to call for intermediate targets. nmake Debug\CvUnit.obj for example will compile CvUnit in the Debug context.

http://forums.civfanatics.com/downloads.php?do=file&id=10018

---
@Glider1 - the PSDK was about 400 MB i think.
 
Back
Top Bottom