Installing and using the SDK

HP_Ganesha said:
owh man... this SDK plataform is a VERY HUGE download... this file is a relly nescessary???? if is I have a GREAT problem...


The SDK is only needed to mod the game... so, you won't need it to patch your game. For that just download the 1.61 patch and install that. ;)
 
Anyone else having trouble loading a newly compiled DLL as a mod?

I changed a line in the source code so that, regardless of what they actually cost, all techs report a cost of 7. If I (after backing up) replace the main CvGameCoreDLL with the new one, the result shows up ... all techs cost the same small number. But, if I put the new CvGameCoreDLL in say /Mods/Tech Cost/Assests/ and then load the mod, it doesn't change and the tech costs return to their previous values ... any thoughts? I tried clearing the cache. Do you need something else in the mod folder to tell it what to load or something?
 
jdog5000 said:
Anyone else having trouble loading a newly compiled DLL as a mod?

I changed a line in the source code so that, regardless of what they actually cost, all techs report a cost of 7. If I (after backing up) replace the main CvGameCoreDLL with the new one, the result shows up ... all techs cost the same small number. But, if I put the new CvGameCoreDLL in say /Mods/Tech Cost/Assests/ and then load the mod, it doesn't change and the tech costs return to their previous values ... any thoughts? I tried clearing the cache. Do you need something else in the mod folder to tell it what to load or something?

If you spelled it Assests like you did above then that is your problem. I have no problem running my modified CvGameCoreDLL.dll out of 'C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods\Fall from Heaven 100\Assets\'
 
OK...so getting it to compile was really easy, both release and debug compiled first time and the compiled release dll works great when I replace the 1.61 version with it, they are even exactly the same size...a very good sign. However (you knew there was one of those coming didn't you!) I am simply unable to get the dll to work in the debugger.

I replaced the release level dll with my dll compiled for debug and then
I tried...
1. Configuring Visual Studio to run the civilization4.exe executable in order to debug the dll.
No luck...I simply get the following message box with no options to go further.
DebugerRunning.JPG

So then I tried
2. Running Civ4 in a separate process with a view to attaching to the process to debug it.
No luck...The Civ4 process never gets going successfully. I get three assertions failures followed by the following debug error.

DebugError.JPG

and then another similar debug error before I finally arrive at the dreaded Civ4 has encountered a problem message.
At each message I have tried all combinations of Ignore and Debug to no avail, the debugger is never in a useful state and all attempts to break the execution give me a 'wait until the debuggee has finished loading' message!

I have tried both ways using both the debug and release C++ MT DLL runtimes.

Oh yes, and I am running Visual Studio.NET 2003 Enterprise Architect (from my MSDN Universal pack).

Apologies if the description is unclear or the answer obvious. I have done a lot of work in C++ but not for several years.
Can anyone help me with this, it is driving me nuts.
Thanks,
Martin.
 
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.
 
A Silly Goose said:
...Yeah, I guess I didn't read some of the thread carefully enough, heh.

Maybe Firaxis will eventually come up with something that'll allow for some level of compatibility with 2005 editions--or maybe something from Microsoft? ...Yeah, better not hold my breath :P

I would assume Firaxis would fix that, but if they are going to I highly doubt it will be released anytime soon (Maybe not untill the expansion). :)
 
Does anybody get it managed to compile the sdk with MS VC++ Express Edition? Besides some warnings which, I think, can be ignored, I get one single error :
CyInfoInterface2.cpp
f:\Civ4\CvGameCoreDLL\Boost-1.32.0\include\boost/python/data_members.hpp(277) : error C2665: 'boost::python::detail::make_getter' : none of the 3 overloads could convert all the argument types

Does anybody know how to prevent this without code changing (by any define or compiler switch)?
 
12monkeys said:
Does anybody get it managed to compile the sdk with MS VC++ Express Edition? Besides some warnings which, I think, can be ignored, I get one single error :


Does anybody know how to prevent this without code changing (by any define or compiler switch)?

I believe the problem you are seeing is because there is a different version of Boost between the version that Firaxis used with the SDK and what VC++ uses.
 
Mmmh! Maybe I'm to stupid to understand that, but Boost is not shipped with MS VC++E. Also, I do USE the Boost version which came with the SDK (look for the path in the error message). So it should not the version itself, it seems to be more a compatibility problem. And maybe there is a switch to set MS VC++E to be compatible with VC 2k3?
 
Fix for compiling with VS 2005

In file CyInfoInterface2.cpp, Line 303:
Change

Code:
	python::class_<CvBonusClassInfo, python::bases<CvInfoBase> >("CvBonusClassInfo")
		.def_readwrite("getUniqueRange", &CvBonusClassInfo::getUniqueRange)
		;

to

Code:
	python::class_<CvBonusClassInfo, python::bases<CvInfoBase> >("CvBonusClassInfo")
		.def("getUniqueRange", &CvBonusClassInfo::getUniqueRange)
		;

I don't know if it affects the functionality somehow. Boost.Python sources are so confusing I couldn't figure out the difference between def and def_readwrite.
 
Suchy are you able to compile a workable CvGameCoreDLL.dll with VS 2005?
 
Yes, the fix for error message that 12monkeys was reporting is in my previous message.

Also, if you want to get rid of warnings, define _CRT_SECURE_NO_DEPRECATE and _CRT_NON_CONFORMING_SWPRINTFS and replace all calls to deprecated functions (stricmp etc) with non-deprecated ones (_stricmp consult MSDN for others).
 
Suchy_63 said:
Fix for compiling with VS 2005

In file CyInfoInterface2.cpp, Line 303:
Change

Code:
	python::class_<CvBonusClassInfo, python::bases<CvInfoBase> >("CvBonusClassInfo")
		.def_readwrite("getUniqueRange", &CvBonusClassInfo::getUniqueRange)
		;

to

Code:
	python::class_<CvBonusClassInfo, python::bases<CvInfoBase> >("CvBonusClassInfo")
		.def("getUniqueRange", &CvBonusClassInfo::getUniqueRange)
		;

I don't know if it affects the functionality somehow. Boost.Python sources are so confusing I couldn't figure out the difference between def and def_readwrite.


I'm now able to compile but the linker throws the folowing error :

Linking...
Creating library Final Release/CvGameCoreDLL.lib and object Final Release/CvGameCoreDLL.exp
CvDLLWidgetData.obj : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function "public: void __thiscall CvDLLWidgetData::doResearch(struct CvWidgetDataStruct &)" (?doResearch@CvDLLWidgetData@@QAEXAAUCvWidgetDataStruct@@@Z)
../Assets/CvGameCoreDLL.dll : fatal error LNK1120: 1 unresolved externals

I have to say, that I do compile the SDK on my second PC where only the SDK is installed and not Civ4 itself. Could that be a reason? If so, what to do?
 
I too am getting a Linker error

fatal error LNK1181: cannot open input file 'winmm.lb'

I though I had preformed all the nessary setup steps correctly but it seems I am missing a library file, any ideas as to ware this library should be coming from and ware it should be installed?
 
Impaler[WrG] said:
I too am getting a Linker error

fatal error LNK1181: cannot open input file 'winmm.lb'

I though I had preformed all the nessary setup steps correctly but it seems I am missing a library file, any ideas as to ware this library should be coming from and ware it should be installed?


This lib is part of the platform SDK. Check your linker directory settings. It should include something like that "c:\program files\Microsoft Platform SDK\lib"
 
12monkeys said:
I'm now able to compile but the linker throws the folowing error :



I have to say, that I do compile the SDK on my second PC where only the SDK is installed and not Civ4 itself. Could that be a reason? If so, what to do?


OK, never mind, problem fixed. User32.lib was missing in the linker libs.

DLL is compiled now and I will try to use it in game.... we'll see!
 
12monkeys, GetKeyState is WinAPI function, it must have something to do with your Platform SDK installation. I didn't install a separate Platform SDK, just used the one that comes with VC++2005.

EDIT: All right, glad you fixed the problem.
 
Back
Top Bottom