How to compile the DLL

For Windows 7 folks, there is a reported incompatibility with VS-2008(sp1). If you see pages and pages of "...unexpected precompiled header error, simply rerunning the compiler might fix this problem", you might have discovered this. (No, recompiling doesn't fix the problem.) The link above does provide a hotfix for VS-2008(sp1), if you want to try that.

What I did instead was install VS-2010. Keep in mind whoward69's warning:
If you want to use VS-2010 to build the DLL (which I was) you need to install VS-2008 FIRST and then VS-2010 (installing VS-2008 after VS-2010 because you forgot to do it doesn't seem to work!)
Since I had followed the OP's instructions, I already had VS-2008(sp1) installed. So I went ahead and installed VS-2010 (download Visual C++ 2010 Express here). I copied CvGameCoreSource to the new appropriate folder (/My Documents/Visual Studio 2010/Projects). Redid steps 6 - 12 (open CvGameCoreDLL.vs2010.sln now). Moved CvGameCore_Expansion2.dll to test mod with VFS=true. Tested. Works.

It's a much nicer interface than VS-2008, anyway, especially if you are already used to it from Modbuddy.


By the way, is there any reason not to change the linker output to go directly to the Modbuddy project folder? It would save me from one drag-and-drop operation, which wouldn't be so bad... [Edit: This is what I do now and it seems fine. Just build in VS-2010, then build in Modbuddy ... and done. No moving files around.]
 
Ok, so after a long time of looking on and wondering what it would be like to do some DLL modding I decided to bite the bullet and try. Here's what I did.

I have been tinkering with programming on and off for many years but never really as anything more than a curiosity, so I already had a working installation of Visual Studio 2010 from the Windows 7.1 SDK iso. I had been able to follow sample code and tutorials so felt sure I could get into this.

First step. Read all the posts.
This thread is full of info about the necessity to have VS 2008 so I was fully expecting to install that at some point.

Step two. Testing the water.
I setup the Civ V SDK as outlined here and made the needed changes to a stock DLL source and see what messages I get back, just to make sure VS 2008 is needed.
It is.

Step three. Install VS 2008.
Now this is where the fun starts. The installation file starts and I am greeted with the message here: (right click and load image in a new tab)

Apparently I already have VS2008 and just need to install SP1.​

Ok, I can do that. Off to the download page again for the SP1 install. This time the installation file starts and gives me this error:

C'mon Microsoft, either I have VS 2008 or I don't, which is it?​

Step four. Minor hiccup.
"No problem", I say to myself, "just uninstall ALL Visual Studio software and start again." A minute or two later I have uninstalled and start the process again.
Same messages again. Apparently I still have an earlier un-updated install on my system.

Step five. Regedit.
So thinking there may be some orphaned references to VS left in the registry I uninstall any software remotely linked to VS 2008, restart Windows and then purge the registry of any mention of Visual Studio, 2008, Silverlight or anything else I can think might be linked to VS 2008. Retry the setup software again and... you guessed it, I still have something in my system that tells MS I have Visual Studio 2008 installed.

Step six. A rethink.
Clearly I am having a Sisyphus moment if I think I can tackle that problem with that strategy. How else can I get to playing with the source code? So I look at the ways the compiler would be set up to look for VS 2008 and that's when it hits me I need a bit of outside input.
What I can imagine is the project either is looking for a specific version of the tools needed to compile the source, maybe linker or assembler or it is looking for specific system files that may somehow be used. (not really sure of the 2nd option)
So I was thinking, what if I created a new VS 2010 project and use the source files to build a DLL?
  • Would it work with the executables in the Civ directory?
  • Would there be a version mismatch between them or possibly just not do anything?
  • In short, is there a way to circumvent the need to have VS 2008 installed?

My immediate answer to those questions is NO! I am not going to be able to work with DLL modding unless I do a complete reformat and reinstall of my system. (that aint gonna happen)

Any ideas? Give up now and be content with xml/sql/lua edits?
 
Regrettably no success. :(

Ah well, looks like I will have to convince my wife I need a new computer. :D
Or not. At least I can still do some of the simpler tasks to do with modding.
Thanks.
 
For Windows 7 folks, there is a reported incompatibility with VS-2008(sp1). If you see pages and pages of "...unexpected precompiled header error, simply rerunning the compiler might fix this problem", you might have discovered this. (No, recompiling doesn't fix the problem.) The link above does provide a hotfix for VS-2008(sp1), if you want to try that.

Quoted for truth. I haven't tried using 2010 though, I'm too extatic from getting 2008 to work at all :crazyeye:
 
Anybody got this working with VS-2013?

When I install VS-2013 it either removes or hides the VS-2008 toolset and also uninstalls VS-2010, so the project no longer builds. If you "upgrade" the project to VS-2013 format (and hence tools) it will compile but now generates hundreds, if not thousands of warnings about unused parameters/variables and potentially un-initialised variables - making it completely impossible to find "real" errors.

I have neither the time nor inclination to fix all the warnings - presumably there is some #pragma warning(disable:) magic that would switch these warnings off

Fortunately, uninstalling VS-2013 and repairing VS-2010 reverted to a position where the project builds - phew!
 
Anybody got this working with VS-2013?

When I install VS-2013 it either removes or hides the VS-2008 toolset and also uninstalls VS-2010, so the project no longer builds. If you "upgrade" the project to VS-2013 format (and hence tools) it will compile but now generates hundreds, if not thousands of warnings about unused parameters/variables and potentially un-initialised variables - making it completely impossible to find "real" errors.

I have neither the time nor inclination to fix all the warnings - presumably there is some #pragma warning(disable:) magic that would switch these warnings off

Fortunately, uninstalling VS-2013 and repairing VS-2010 reverted to a position where the project builds - phew!

This is a good warning, I was planning on installing VS2013 soon. Isn't there an option in VS2013 to not show warnings in the errors window like in 2008/10/12? I've found that the Firaxis code warnings make trying to view any unhelpful (unfortunately, because they can pick up helpful stuff), but you still get errors separately.
 
Isn't there an option in VS2013 to not show warnings in the errors window like in 2008/10/12?
Possibly, but Visual Studio is not my forte, so I was hoping someone else could work it out ;)

I've found that the Firaxis code warnings ...
There weren't that many with VS-2008/10 - a few unused parameters and some things which should have been _noop - that it was easy enough to mod the source to remove them.

But in VS-2013 there were pages and pages and pages of them - easier to revert to VS-2010 than spend time and effort fighting with an environment I only use for fun
 
Have you found the following in CvDllContext.cpp and made the required change?

Code:
// WARNING! This must be unique for each DLL!
// If you are a modder and you are creating your own DLL from the original source, this must be changed to a unique GUID.
// Use the Visual Studio Create GUID option in the Tools menu to create a new GUID.
// {C3B2B6B3-439C-480b-8536-1CF39FCFC682}
static const GUID CIV5_CORE_RELEASE_DLL_GUID =
{ 0xc3b2b6b3, 0x439c, 0x480b, { 0x85, 0x36, 0x1c, 0xf3, 0x9f, 0xcf, 0xc6, 0x82 } };
A small note about this since it had me confused for a moment: I'm not sure if this was always the case, but the code mentioned above is now located not in CvDllContext.cpp but in CvDllVersion.h.
 
What I had to do to get this working in VS2013:

Installed VS2008
Successfully compiled DLL in VS2008
Installed VS2013
Opened the 2010 solution in VS2013, got the ""Visual Studio 2008 (v90) Not Installed" Error.
(I did not upgrade the 2010 solution to a 2013 solution)
Installed \Setup\vc_stdx86.exe from GRMSDKX_EN_DVD.iso
(from http://stackoverflow.com/questions/33173296/building-vc-2008-project-with-vs-2013)

Now the 2010 solution compiles successfully in VS2013.

I tried the vc_stdx86.exe trick with VS2015, which solved the "v90 Not Installed" error. However immediately on Build, I get an error I could not solve. (So I use VS2013, and not VS2015).

Code:
1>------ Build started: Project: CvGameCoreDLL, Configuration: Mod Win32 ------
2>------ Build started: Project: CvGameCoreDLL_Expansion1, Configuration: Mod Win32 ------
3>------ Build started: Project: CvGameCoreDLL_Expansion2, Configuration: Mod Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(57,5): error : Required file "" is missing.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(57,5): error : Required file "" is missing.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(57,5): error : Required file "" is missing.
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

(Thanks for the help from whoward69)
 
I don't remember how I got my original VS 2008 Express, but it had a 30 day trial timer and no way to register to disable it.

Isn't Express the free edition of VS? I didn't think that required registration to work. The ones that cost money (Professional/Ultimate) might do.
 
I don't know MS's convoluted process by heart, but the simple setup I used did, and the registration page is no longer online since its vs2008, so it stopped working on the 30th day, and what people suggested was that I fully uninstalled (to remove whatever registry kept track of my expired trial) and used the pre-registered ISO instead, which if you download, wont compile the dll because it doesnt have SP1, and the SP1 update only applies to the paid version, so you have to uninstall again and find the ISO of Express with SP1 already patched in...

I was also told that I had to first uninstall all newer versions of visual studio I had installed on top, or the thing would probably not work and would remember my lack of activation, after I had 2008 working I could reinstall newer versions on top of it.

For some reason I remember uninstalling the 2010 shell that you must use for the Civ SDK, not sure it was actually necessary or just me trying everything to make things work...

I don't get any trial messages now and can compile, so I think it works.
 
So I'va downloaded VS 2008 from the link and followed the instruction to load the project. When I try to compile, I have the error

LINK : fatal error LNK1104: cannot open file '\CvGameCoreDLLWin32Mod.dll'

What do I do from here?
 
Going to need more info.

Where are you trying to compile the code from - the SDK location or have you copied the source code from the SDK location into the "My Documents" (typically "C:\Users\{username}\Documents\Visual Studio 2008\Projects") area?
 
Top Bottom