• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Installing and using the SDK

MatzeHH said:
Do you use the compiler option /Zi?
Below are all my command line options for the compiler and the linker as generated by VS2003. As you can see I have /ZI rather than /Zi but this means basically the same it just includes the VS2003 support for edit and continue as well as the regular debug data.

Compiler:
/Od /G7 /I "Boost-1.32.0\include" /I "Python24\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "CVGAMECOREDLL_EXPORTS" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MD /Gy /GR /Yu"CvGameCoreDLL.h" /Fp"Debug/CvGameCoreDLL.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /ZI /Gd /TP

Linker:
/VERBOSE /OUT:"../Assets/CvGameCoreDLL.dll" /INCREMENTAL /NOLOGO /LIBPATH:"Python24\libs" /LIBPATH:"boost-1.32.0\libs\\" /DLL /NODEFAULTLIB:"msvcprtd.lib" /DEBUG /PDB:"Debug/CvGameCoreDLL.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"Debug/CvGameCoreDLL.lib" /MACHINE:X86 boost_python-vc71-mt-1_32.lib winmm.lib msvcprt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\Boost-1.32.0\libs\boost_python-vc71-mt-1_32.lib"
 
Thanks for your help!

Unfortunately I still have this compiler error:
CyCityInterface1.cpp
e:\Microsoft Visual C++ Toolkit 2003\include\memory(498) : fatal error C1067: compiler limit : debug information module size exceeded

Searching the net, I figured out, that this has something to do with to many characters in a class name or a constant.

Any idea?

Matze
 
Well, I kicked that Code::Blocks from my Harddisk, went to my office and grabbed a copy of Visual Studio 2003.
I followed your instructions and finally I got the debug mode running.

This is really great! Understanding the code is so much easier with the debug mode! It would have last days to find out why the AI doesn't build my brand new settleboats without the debug mode.

Matze
 
MatzeHH said:
finally I got the debug mode running
That's Great, congratulations!
MatzeHH said:
Understanding the code is so much easier with the debug mode!
I agree completely...debug mode is fantastic for understanding what the AI is thinking (so to speak) and stepping through combat and many other interesting routines.
 
Well, I have run into MAJOR difficulties. I hope someone can sort me out :).

When I get to the Build ------> Build step, I get the following error message:

LINK Fatal Error LNK1104: cannot open file 'msvcprt.lib'


So, what does it mean, and how do I get around it?

Aussie_Lurker.
 
Aussie_Lurker,
I assume you are using the free toolkit from MS...(BIG assumption)

A few minutes of googling came up with this...

For some reason MS in their infinite wisdom does not ship msvcprt.lib with the freely downloadable toolkit.

You can build it yourself using the instructions in section 3.2 of this page...
http://www.delta3d.org/article.php?story=20050721180227305&topic=tutorials

or

you can download it directly from the link towards the bottom of this page...
http://root.cern.ch/root/Procedure/Procedure to install the free Microsoft Visual C.htm

Of course, if you prefer I can just send da boys round to sort you out :)
 
Is anyone else here completely lost? :confused:

Can someone help me a little more with the basics, i dont understand a thing..

Or maybe i have the wrong Visual studio.. i downloaded the newest version called VC++ 2005 Express Edition, does that work just as good?
 
VC++ Express Edition won't work. You'll need VC++ 2003 Toolkit or Visual Studio 2003 .NET to compile a usable DLL. Sorry, there is currently no other way.

If you can't get the Visual Studio, refer to the first post of this thread and follow the instructions.
 
ive done that, but i still end up on the page where it says that the vc++ toolkit is an old version and that i cant download it.. and then i get to the same place where they tell me to download the new 2005 express..

dammit :mad: .. oh well

thx anyway
 
mjs0 said:
Eureka! :beer: :dance: :clap: I finally got debug mode to work.

It turns out that even though I was using /MD (standard multi-threaded runtime for DLLs) rather than /MDd (debug multi-threaded runtime for DLLs) it was still pulling in one of the debug libraries (msvcprtd.lib).
I have no idea why this was pulled in to the linked DLL so I took the brute force approach of specifically excluding that library and adding the standard equivalent (msvcprt.lib) to the additional dependencies list.
I can now successfully start Civ4 in its own process using the debug version of the DLL. If I then attach a VS debug session to that process I can happily set breakpoints and step through the code!

As a quick test I manually changed the experience of a unit using the C++ debugger and when I hit continue my spearman suddenly had quite a few promotions coming! (Now where did I see that tank!)

Hope this helps others who might be having the same problem.
Martin.

I compiled CvGameCoreDLL.dll (and copy to Assets\).
Because I never used debuger: HOW to debug Civ4? :confused:
I have tried Tools->Debug Processes... and then attach Civ4 process, but I can't change any variable, and when set breakpoint game freezes (this is probably normal), but then I can't gain acces to the Microsoft Visual Studio .NET 2003.
 
MatzeHH said:
Thanks for your help!

Unfortunately I still have this compiler error:
CyCityInterface1.cpp
e:\Microsoft Visual C++ Toolkit 2003\include\memory(498) : fatal error C1067: compiler limit : debug information module size exceeded

Searching the net, I figured out, that this has something to do with to many characters in a class name or a constant.

Any idea?

Matze

I made some progress on this. It is caused by putting too many boost.python .def()'s in one file.
See http://www.boost.org/libs/python/doc/v2/faq.html#c1204.

For example, in CyCityInterface1.cpp:
Code:
void CyCityPythonInterface1(python::class_<CyCity>& x)
{
	OutputDebugString("Python Extension Module - CyCityPythonInterface1\n");

	x
		.def("isNone", &CyCity::isNone, "void () - is the instance valid?")
		.def("kill", &CyCity::kill, "void () - kill the city")
		.def("doTask", &CyCity::doTask, "void (int eTaskTypes, int iData1, int iData2, bool bOption) - Enacts the TaskType passed")
		.def("chooseProduction", &CyCity::chooseProduction, "void (int /*UnitTypes*/ eTrainUnit, int /*BuildingTypes*/ eConstructBuilding, int /*ProjectTypes*/ eCreateProject, bool bFinish, bool bFront) - Chooses production for a city")
		// repeat for 380 lines...

The fix is simple, just break it up into a smaller files. Then modify CvDLLPython.cpp to call the smaller files. I attached the files I patched to make CyCityInterface1.cpp compile with debug symbols. (You need to add the new files 2,3,4,5,6 with CodeBlocks Project -> Add Files...)

Files that need to be broken up:
CyCityInterface.cpp (done)
CyGameInferface.cpp
CyGlobalContextInterface1.cpp
CyGlobalContextInterface4.cpp
CyMapInterface.cpp
CyPlayerInterface1.cpp
CyPlotInterface1.cpp
CyTeamInterface.cpp
CyUnitInterface1.cpp

After commenting out all the .def()'s in the above files I compiled with debug symbols successfully.
 

Attachments

OK, really DUMB question here but, what does Compiling actually entail-and how do I go about it?
For example, I have added two new XML 'hooks' for civics-namely StateReligionCommerceModifier and StateReligionYieldModifier. Obviously I have also gone through the rest of the CvInfos source and header to add the various arrays where they belong etc etc, but now I want to make it in to my final product. This is obviously where compiling comes into it, but I can't find a 'Compiler' button in Code::Blocks. Could someone point me in the right direction?
Thanks in advance.

Aussie_Lurker.
 
Am I correct that no one has yet managed to succesfully run Debugging through CodeBlocks? McV aproach seems to be the closest anyone has gotten though it will probably be a quite a hastle to make the alterations all signs are that once completed he will be able to compile and debug with CodeBlocks alone. If so I sugjest we all pitch in and work through thouse Interface files ASAP.
 
I keep getting a bunch of these for every file during the build process....:lol: Is this how it's supposed to be? This is my 1st time,newbie here! Help:p

cl : Command line warning D4002 : ignoring unknown option '/O0'
cl : Command line warning D4024 : unrecognized source file type 'EHsc', object file assumed
cl : Command line warning D4027 : source file 'EHsc' ignored

Then an fatal error cannot open file msvcprtd.lib

I put that file in C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib

Actually the file I have is msvcprt.lib........I don't have msvcprtd.lib,where can I get it?
 
casey1966 said:
I keep getting a bunch of these for every file during the build process....:lol: Is this how it's supposed to be? This is my 1st time,newbie here! Help:p

cl : Command line warning D4002 : ignoring unknown option '/O0'
cl : Command line warning D4024 : unrecognized source file type 'EHsc', object file assumed
cl : Command line warning D4027 : source file 'EHsc' ignored

Then an fatal error cannot open file msvcprtd.lib

I put that file in C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib

Actually the file I have is msvcprt.lib........I don't have msvcprtd.lib,where can I get it?


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
 
Aussie_Lurker said:
OK, we have these lines

Code:
'<unknown>': modifiers not allowed on non-member functions
          function returns function
Both are in relation to this line of code:

Code:
DllExport int getStateReligionCommerceModifier() (int i) const;             
	int* getCommerceModifierArray() const;

and something similar for Dll Export int get StateReligionYieldModifier() (int i) const;

Does that help at all?

Aussie_Lurker.

This doesn't look to be a problem installing and using the sdk, but making your custom changes. You may want to cover this issue in a new thread.
 
Back
Top Bottom