A simple guide to compiling the DLL

I keep getting an error when I try to load it that says "one or more items failed to load" or something to that effect.
 
I keep getting an error when I try to load it that says "one or more items failed to load" or something to that effect.

Be more specific so we can help.
 
Hi everyone,

i'm getting this steam error : "Application load error T:0000065432"
when trying to use the Debugger (with visual C++ Express 2008).
compiling works fine, mod works fine, even the Starting without Debugging option of Visual C++ (Ctrl+F5) works as intended. Anyone had a similar issue ?
 
I was compiling the Cvgamecoredll.dll but I recieved this error: "1>CvPlot.obj : error LNK2019: unresolved external symbol _GetProcessMemoryInfo@12 referenced in function "bool __cdecl NeedToFreeMemory(void)" (?NeedToFreeMemory@@YA_NXZ)"
Someone knows what does it mean?
 
Could someone help me with this guide? Most of the links worked fine and I could download the Toolkit and the Windows Platform (steps 2 and 3, respectivelly) without problem, but when I tried to install Visual Studio 2008 from step 1, it could not download the very first component, "Runtime pre-requisites", it kept trying to estabilsh a connection with the server, but it wouldn't work even though internet is doing fine (maybe Microsof no longer works with the 2008 version?). I tried to use the offline installer he suggested, but that link is dead. Could I use a more recent version of Visual Studio, such as 2022? If so, should I do something different with it to work with Civilization?
 
I use vs 17, not 2008, just need to adjust some of the files.
I recommend you use kmod mod a a base for modding. There is an make ready and more.

Do you know the place telling which files to change? The guide here talks about such a thing for the Visual Studio 2010, but maybe the method is different for VS2022 or VS2017.
On a plus note, it's interesting you have suggested the Kmod, for this is exactly the one I was using :lol:. Technically, I'm working with the History Rewritten mod, but it uses the kmod as basis. I believe this might be the source code of the mod, but another thing I've noticed is that this source does not contain any sln file. It has the makefile and the vcproj, but the sln specified in the guide I could not find. Should I, in this situation, use the sln that comes with the archive Asaf provided in step 4?
 
@Eusebio: There's a more recent guide in the SDK/Python subforum. I haven't double-checked, but I assume that the link to VS2010 there still works. I'm not aware of any downside to using VS2010 over VS2008. Versions more recent than VS2010 may require 2010 (or 2008 or 2005 I guess) to be installed alongside the newer version. With VS2022, specifically, even that might not suffice.

HR has modified the K-Mod DLL, but the HR source code isn't really publicly available as far as I understand: no HR code repository
Xyth has uploaded his code a few posts above the one I linked to, but I don't know if that's a stable version and what changes he may have made since then. keldath might have something slightly more recent(?). Well, I guess you could start from whatever source you can get your hands on and sync up with Xyth's latest changes if and when he uploads them (or maybe sends them to you?).

Visual Studio should create a solution (sln) file for you (along with some other project files) when you open the vcxproj file from K-Mod/ HR.

Edit: typo
 
Last edited:
Thanks for all the help I'm receiving! I followed the link f1rpo suggested, and everything downloaded fine and seems to be working properly. Here is whats is happening now:

-I open the "CvGameCoreDLL.vcproj" with VS2010, and the first thing it tells me is that "The solution or project you are opening must be converted". I just proceed with everything, allowing backup files to be created and such, and everything seems to work fine. The log shows that the file was converted and, indeed, I can navigate the Solution Explorer tab with the correct header, sources and all. I think everything is working well, so far.
-Given that I'm using VS2010, I tried to take Sareln advice, in step 1 from the guide, where he/she suggests we make sure the configuration type is set as makefile, etc. Configuration type is set to makefile as suggested, and the "build all" and "rebuild all" command lines are set as "nmake Debug" and "nmake Debug_cleannmake Debug", respectivelly. Hopefullly this is what was meant by them "making sense".
-Finally, I try to build the solution, I go Debug -> Build Solution and let it run. This is where an error occurs: the log says the execution encountered an error, and gives this line: "NMAKE : fatal error U1052: file 'Debug' not found". Could this have something to do with the makefile I'm using? I am using the makefile found in the k-mod sources I've linked on the other posts, but I made sure to change the path for TOOLKIT and PSDK accordingly.
-Another problem I encountered was that this makefile by default uses an executable called "fastdep.exe", which seems to be missing in my computer, but once I set this line as a comment disabling it, the error disappeared, so maybe this isn't necessary for the procedure to work.

Thnaks once again for all the help you guys were giving me :goodjob::goodjob::goodjob:
 
The guide here talks about such a thing for the Visual Studio 2010, but maybe the method is different for VS2022 or VS2017.
Short answer:
It doesn't matter which version of MSVC you use. If the project file is too old for MSVC it will update it automatically the first time you open it.

The only time the version really matters is if multiple people work on the same mod using the same project file. In this case it's not great if one person updates it to 2019 and another one is using 2010, which then has to read a file format from the future. This isn't about compiling, but rather being able to open the project file.

Long answer (more technical):
The DLL needs to be compiled with the same version as the exe and it is compiled with the 2003 version. We call this one using command line calls and since there are a lot of those we use the file called Makefile to automate this process. The version of MSVC you use will not compile for you. Instead the project file is coded to call the Makefile. Since all versions call the Makefile and nothing else, which version you pick is mainly a preference for what you want to look at/use while programming. We The People and Caveman2Cosmos both have bat files to compile, skipping the need for MSVC entirely (except for the command line version of the 2003 compiler). I wouldn't recommend using the bat file approach if you do any programming yourself, but that's another story.
 
[...] Here is whats is happening now: [...] the log says the execution encountered an error, and gives this line: "NMAKE : fatal error U1052: file 'Debug' not found".[...]
That all sounds good, I'm getting the same results with those K-Mod files from GitHub – except for the nmake error, i.e. compilation works for me with VS2010. Well, I also had to copy Boost and Python 2.4 to the CvGameCoreDLL folder; no CIVINSTALL variable in that old makefile. But I don't think that's what's causing your error. Are all the files (project files, makefile, .h, .cpp files) in the same folder? This post by Asaf says that the error message means that the makefile can't be located. Edit: Attaching screenshot of folder structure.

I hadn't expected the K-Mod project file to be this ancient. I guess karadoc stuck to VS2008. I've checked Xyth's archive – that already includes a vcxproj file that VS2010 should understand, an sln file and fastdep. There's also Nightinggale's updated makefile along with VS project files. I don't think K-Mod or HR have any extra libraries they need to include or preprocessor defines (the KMOD_PATH_FINDER flag in K-Mod's vcproj file is obsolete), so you could probably just discard the K-Mod/ HR stuff. But I don't think it matters much for now so long as you can get it to compile at all.
 

Attachments

  • folder-structure.jpg
    folder-structure.jpg
    836.5 KB · Views: 41
Last edited:
-Finally, I try to build the solution, I go Debug -> Build Solution and let it run. This is where an error occurs: the log says the execution encountered an error, and gives this line: "NMAKE : fatal error U1052: file 'Debug' not found". Could this have something to do with the makefile I'm using? I am using the makefile found in the k-mod sources I've linked on the other posts, but I made sure to change the path for TOOLKIT and PSDK accordingly.
No idea why the makefile would want to use debug as a file. It sounds really wrong. The newest makefile (to my knowledge) is my own (signature) and I never heard of that issue happening with that one.

One common issue people can have while compiling is not being able to find nmake.exe itself. The simple fix for that is to copy the file from the compiler into the folder with the project file. Not sure if it will make a difference here though.

If I am to say anything else about this error I would prefer the full log, not just the fatal line. There might be hints in previous lines too.

-Another problem I encountered was that this makefile by default uses an executable called "fastdep.exe", which seems to be missing in my computer, but once I set this line as a comment disabling it, the error disappeared, so maybe this isn't necessary for the procedure to work.
Fastdep is used to generate a list of which header files each cpp file uses. The compiler will then compile the cpp file if any of the header files has been modified. Without fastdep it will only recompile if the cpp file changes and this will cause issues. You can get around this issue if you use make clean each time as it clears the cache of last compilation. However this forces a complete recompile each time meaning it will be slower. It will however do at least until you manage to compile.

You can copy fastdep.exe from any mod as there is only one version of it. I put it in WTP meaning you can download it here. Ages ago somebody always had fastdep crashing so I wrote a perl script to do the same thing and I think it is still in Medieval Conquest. I would recommend the exe version though if it works because the perl script is more picky when reading include lines due to being written fairly simple/fast (worse perhaps, but it did work for the mod in question so good enough back then).
 
[...] Ages ago somebody always had fastdep crashing so I wrote a perl script to do the same thing and I think it is still in Medieval Conquest. I would recommend the exe version though if it works because the perl script is more picky when reading include lines due to being written fairly simple/fast (worse perhaps, but it did work for the mod in question so good enough back then).
A small off-topic note about fastdep crashes: I've run into a few of those myself. I had to check in the "depends" file that fastdep generates to see which .cpp was responsible. Then, trial and error removing header inclusions and preprocessor directives. The causes turned out to be pretty random – e.g. the <stack> header as the last included header caused a crash –, so it seems that these are just bugs in fastdep that one has to work around. Fortunately, these issues seem quite rare.
 
Hey guys, sorry for the delay. I tried to repeat the process just like last week, naturally the result was the same error, but I wanted to take a closer look at the error log. I'm pasting the full log below, as suggested by Nightingale, but one line in particular called my attention:

-'C:\Users\eusebio\OneDrive\Ã?rea' não é reconhecido como um comando interno ou externo, um programa operável ou um arquivo em lotes.'

This line is in portuguese (I'm from Brazil and my operating system uses the portuguese language). Translating it, it says something like:

-'C:\Users\eusebio\OneDrive\Ã?rea' is not recognized as an internal or external command, operable program or batch file.

In particular, what calls my attention is the "Ã?rea" bit: in reality, he's trying to add here "Área de Trabalho", portuguese from what would be "desktop", but looks like the operating system might be having a problem dealing with that diacritic added to the first A, this is somewhat commom when dealing with different languages. You guys think this could be the source of the problem? In any case, below I'm posting the entirety of the log outputed by the operation:



###########################
Build started 03/06/2022 18:13:24.
1>Project "C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\KMod - HistoryRewrriten\A Trabalhar\CvGameCoreDLL.vcxproj" on node 2 (build target(s)).
1>PrepareForBuild:
Creating directory "obj\Win32\Release\".
Build:
nmake Release

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

"C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\DependenciesForBuilding\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /Og /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\DependenciesForBuilding\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\DependenciesForBuilding\WindowsSDK/Include" /I"C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\DependenciesForBuilding\WindowsSDK/Include/mfc" /YcCvGameCoreDLL.h /Fo"Release\_precompile.obj" /c _precompile.cpp
'C:\Users\eusebio\OneDrive\Ã?rea' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
1>NMAKE : fatal error U1077: '"C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\DependenciesForBuilding\Microsoft Visual C++ Toolkit 2003\bin\cl.exe' : return code '0x1'
Stop.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "nmake Release" exited with code 2.
1>Done Building Project "C:\Users\eusebio\OneDrive\Área de Trabalho\Artes\CivilizationModding\KMod - HistoryRewrriten\A Trabalhar\CvGameCoreDLL.vcxproj" (build target(s)) -- FAILED.

Build FAILED.

Time Elapsed 00:00:02.20
###########################
 
Top Bottom