1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Installing and using the SDK

Discussion in 'Civ4 - Creation & Customization' started by Kael, Apr 13, 2006.

  1. Agent 009

    Agent 009 Civ 4 Addict

    Joined:
    Mar 28, 2006
    Messages:
    346
    Location:
    In a virtual Civ 4 Environment.

    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. ;)
     
  2. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    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?
     
  3. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    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\'
     
  4. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Wow ... I can't believe I failed at spelling. Thanks! That was bugging me for a while. Best part is I managed to mispell it the same way in my post and in mod folder. (Off to write Assets on the board 100 times) ...
     
  5. mjs0

    mjs0 The 4th X

    Joined:
    Nov 9, 2001
    Messages:
    1,063
    Location:
    Central Florida
    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.
     
  6. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    I dont think the version of Civ4 we have is meant to run debug dll's.
     
  7. mjs0

    mjs0 The 4th X

    Joined:
    Nov 9, 2001
    Messages:
    1,063
    Location:
    Central Florida
    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.
     
  8. vbraun

    vbraun Raytracing

    Joined:
    Jul 7, 2003
    Messages:
    3,530
    Location:
    Arizona, USA
    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). :)
     
  9. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe
    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)?
     
  10. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    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.
     
  11. A Silly Goose

    A Silly Goose Goose of Silliness

    Joined:
    Jan 15, 2006
    Messages:
    157
    Location:
    South Carolina, USA
    Yeah, that's the problem I had when I tried to get VC++E working. I can't find a way to use anything other than the default compiler, either...
     
  12. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe
    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?
     
  13. Suchy_63

    Suchy_63 Chieftain

    Joined:
    Jun 1, 2004
    Messages:
    10
    Location:
    Montreal
    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.
     
  14. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    Suchy are you able to compile a workable CvGameCoreDLL.dll with VS 2005?
     
  15. Suchy_63

    Suchy_63 Chieftain

    Joined:
    Jun 1, 2004
    Messages:
    10
    Location:
    Montreal
    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).
     
  16. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe

    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?
     
  17. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    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?
     
  18. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe

    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"
     
  19. 12monkeys

    12monkeys Prince

    Joined:
    Nov 24, 2003
    Messages:
    440
    Location:
    Germany, Europe

    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!
     
  20. Suchy_63

    Suchy_63 Chieftain

    Joined:
    Jun 1, 2004
    Messages:
    10
    Location:
    Montreal
    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.
     

Share This Page