Installing and using the SDK

I had that error once. Go to Project->Build Options. Select "Final Release" from the menu on the left. Make sure that the first check box, "Produce Debugging Symbols [/Zi /D _DEBUG]" is NOT checked.
 
Talchas,
Do you mean that setting these options reduced the size of the CvGameCoreDLL.dll?
Yes, I think thats what it was.
If so, where are these options posted to CodeBlocks? Perhaps Project Build Options > Final Release > "Other Linker Options" tab?

Thanks!
Spocko
I don't really remember, but that sounds about right. Give it a try.
 
Figured it out...on the main CodeBlocks screen where it says at the top right
Build target: please select "final release" instead of "all".....:lol:

It's working fine as I speak...Thanks Kael

Thats it, I have also realized it after reading your post, that it is necessary to choose "final release".
PL
 
Hello,

and another problem :

CodeBlockScreen-Memory.JPG


and the Build Log of the same problem :

CB-MemoryBuildLog.JPG


I checked the steps and the build is starting very properly but then I get this memory error.

Hello the solution for these problems is (like gordon mentioned) that in build options you not only have to uncheck the debugging, but on the screen where you change the EHsc into /Ehsc you will also find /Zi. This has to be deleted to .
 
I understand that Civ 4 was written for and compiled in MS Visual Studio C++ .NET 2003, correct?

And that because of compiler inconsistencies we cannot edit the SDK nor compile it using Visual Studio C++ 2005 Express?

Is there any workaround to this? I'd much rather work in VS than Code::Blocks.

Thanks for any helpful hints.
 
To me, that's the problem with using a proprietary language ... today's edition is incompatible with tomorrows, not because it has to be, but because otherwise you wouldn't buy the next version, and the next one, and the next one... you have to keep running to stay in place. That is my impression, at least.
 
Umm well...it's not a proprietary language, it's the most common language on the planet. C++ compiler inconsistencies are well-documented.

It's just that Firaxis wrote Civ4 in v.2003 probably because that was the latest release at that moment (2005 was probably still in development or beta at the time). And now 2005 compiles differently than 2003 if I understand correctly.

But surely there's a workaround, anyone?
 
I got it to work with VC++ 2005 Express! Well, not exactly - it still uses VC++ 2003 Toolkit to compile and link, but now I can tinker with the SDK in the VC++ 2005 IDE.

YES!! THANK THE GOOD LORD! I got this workaround going, compiled and tested a .dll, and it's wonderful.

Thanks a million for this!

------------------------------------------------------------------------------------------------------------------

EDIT: OK after spending a few hours on Visual C++ 2005 Express, and having spent 50+ hours on Code::Blocks, I have to tell you all the difference brings tears to my eyes. The Microsoft product is LIGHT YEARS ahead of Code::Blocks. It's faster, simpler, easier, much more powerful and intuitive than the other. And it's FREE as well. You'll get more done and have less headache. Do yourself a favor.

I suggest the first post be edited and replaced with Maian's procedure for using the 2003 Toolkit with MS Visual C++ 2005 Express.
 
I can't access the microsoft website when using windows but i can access it via linux (long story, yes i have a legal copy etc but i think microsoft blocked my xp).

Is there any way to get a copy of VC++ 2005 Express through a mirror site? Or from cd/dvd?
 
Now - what do I need to do to run debugging for this in Visual C++ 2005 Express?

When I try to debug it prompts me for the location and name of a debug.exe.
 
Sorry, I am late to the discussion. TheLopez mods for Air Forces and Military Bases inspired me to become a Civ IV modder. I too have downloaded the Visual Studio 2005 Express edition (i.e free C++ compiler from MS), and have just begun my modding experience. I am starting by compiling unmodified SDK files to ensure I can compile & create the DLL. I get the noted compiler error ['boost::python::detail::make_getter' : none of the 3 overloads could convert all the argument types]. Is there an identified solution allowing use of VSE 2005 for Civ IV modding? Any insight is appreciated.
 
The solution for using MS Visual C++ 2005 Express to mod the SDK is found at post # 178 in this thread.

It works perfectly and is so much better than Code::Blocks!

As an added bonus, I find that the compiled CvGameCoreDLL.dll is approx. .45 MB smaller in size vs. the one compiled in Code::Blocks.
 
Forgive me if I get too technical here, but I think (read "hope") there might be a much simpler way of compiling with Visual C++ 2005 Express.

There is a compiler switch that changes the default handling of wchar_t from a built-in type to an unsigned short. From what I can tell, changing the handling of the wchar_t type changes the decorated function names in the DLL compiled by VC++ 2005 (those reported by "dumpbin.exe /EXPORT CvGameCoreDLL.dll") so that they are the same as those in the original DLL.

The switch can be found in the Project Properties dialog box, under Configuration Properties -> C/C++ -> Language. Simply change "Treat wchar_t as Built-in Type" from "Yes" to "No (/Zc:wchar_t-)" and recompile.

I have tried that twice now and had two completely stable quick games of Warlords without a hitch.

Please can someone else try that from a clean set of source files to see if it really works, or if I'm just dreaming?!

Monty
 
I tried it on an old set of source files (I think they were clean) and, except for the 613 warnings about ''sprintf' was declared deprecated", it built unproblematically.

Congratulations! :b:
 
Thanks for the support in compiler under Visual C++ 2005 Express. After giving up much computer time to my son for a school project, I was able to get back to setup & compile activities. The approach documented in post 178 did result in successful compile of the clean source files. More work to come.
 
Forgive me if I get too technical here, but I think (read "hope") there might be a much simpler way of compiling with Visual C++ 2005 Express.

There is a compiler switch that changes the default handling of wchar_t from a built-in type to an unsigned short. From what I can tell, changing the handling of the wchar_t type changes the decorated function names in the DLL compiled by VC++ 2005 (those reported by "dumpbin.exe /EXPORT CvGameCoreDLL.dll") so that they are the same as those in the original DLL.

The switch can be found in the Project Properties dialog box, under Configuration Properties -> C/C++ -> Language. Simply change "Treat wchar_t as Built-in Type" from "Yes" to "No (/Zc:wchar_t-)" and recompile.

I have tried that twice now and had two completely stable quick games of Warlords without a hitch.

Please can someone else try that from a clean set of source files to see if it really works, or if I'm just dreaming?!

Monty

I haven't got Varlords yet but trying your trick on the vanilla Civ4 gives a breakpoint giving a message indicating a "invalid parameter" at
CvGameCoreDLL.dll!02293f8d()

and running from debugger directly from start tells me about heap corruption.

I can try out you fix when I got Warlords but as the looks of it doesn't the fix work for vanilla Civ4.
 
Ok. I have tried to get it going with VC++ '05 Express but I keep getting:
1>------ Rebuild All started: Project: CvGameCoreDLL_vc2k5, Configuration: Final_Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 7.00.8882
1>Copyright (C) Microsoft Corp 1988-2000. All rights reserved.
1>NMAKE : fatal error U1052: file 'Final_Release' not found
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:\Documents and Settings\David K\My Documents\Visual Studio 2005\Projects\CvGameCoreDLL_vc2k5\CvGameCoreDLL_vc2k5\Final_Release\BuildLog.htm"
1>CvGameCoreDLL_vc2k5 - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I am at my witts end. I have (as far as I know) created Final_Release in the configuration manager. I have made sure that everything in the configuration manager points to Final_Release and I have deleted Debug and Release. But I keep getting the error. Any ideas?
 
I too, experienced the same error when first working through the steps for VC++ 2005 Express. I deleted and re-created my project several times and even changed the directory structure I was placing my project in. All to no avail. I created 'Final_Release' folders in more places than I care to admit, and even removed the 'Final_Release' portion from the make file in an attempt to find out where the project was trying to create the DLL. Enough of my whining....

Walk through the instructions carefully in a fresh attempt. Pay particular attention to the directions around setting the location to the parent directory of where the SDK has been extraced too and then entering the SDK location in the name field. When you add the files to the project be sure to add ALL files. I changed the default file type filter to *.* to see all files in the directory.

After paying particular attention to these two details on a fresh attempt, I was able to successfully compile the project.

Good luck. The approach does work.
 
Yep, got it :D Thanks mtcharter :)

I had to still do it a few times though. What ultimately got it working was:

a) I decided to not create a solution folder (ie, CvGameCoreDLL\CvGameCoreDLL). That way everything is put into the one folder.
b) I actually put the make file, along with all the project information all in the same folder as the source files.

The problem I reported in the last post was because it couldn't find the Make file. Once I put it into the right folder (the solutions folder - which is where it seemed to recognise the make file) it came up with a 'don't know how to build CvArea.cpp' error. I then scrubbed this solution subdirectory thing so that everything was in the same folder and it worked.... well, hopefully. It is still building while I write this...

Hmmm. Got a linker warning about all references to 'KERNEL32.dll' discarded by /OPT:REF
Code:
...
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 _precompile.cpp /FoFinal_Release/_precompile.obj
1>_precompile.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/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/CvDLLButtonPopup.obj Final_Release/CvDLLEntity.obj Final_Release/CvDLLPython.obj Final_Release/CvDLLWidgetData.obj Final_Release/CvDeal.obj Final_Release/CvDiploParameters.obj Final_Release/CvFractal.obj Final_Release/CvGame.obj Final_Release/CvGameAI.obj Final_Release/CvGameCoreDLL.obj Final_Release/CvGameCoreUtils.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/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/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/CyPlayer.obj Final_Release/CyPlayerInterface1.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>Build log was saved at "file://c:\Documents and Settings\David K\My Documents\Visual Studio 2005\Projects\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
but it succeeded :goodjob: Thanks again :) Is that warning of anything to be concerned about?
 
Back
Top Bottom