Trying (an failing) to compile a DLL

Moi Magnus

Emperor
Joined
Mar 1, 2015
Messages
1,868
I've never done .dll mods before, and decided to try.
I've download the last version of Visual C++, and followed this : https://forums.civfanatics.com/threads/how-to-compile-the-dll.479374/

However, I still can't compile the unmodded dll:

I first had to add "_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1;" to the preprocessing, but it still fail completly:
Spoiler :

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>_precompile.cpp
1>c:\users\marc\source\repos\cvgamecoresource\fireplace\include\fireworks\FMemHooks.h(59): warning C4091: 'typedef ': ignored on left of 'eMPoolType' when no variable is declared
1>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2039: 'auto_ptr': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\unordered_map(15): note: see declaration of 'std'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1873): note: see reference to class template instantiation 'CvEnumerator<T>' being compiled
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvUnit.h(1077): warning C4091: 'typedef ': ignored on left of 'CvUnit::Flags' when no variable is declared
3>_precompile.cpp
3>c:\users\marc\source\repos\cvgamecoresource\fireplace\include\fireworks\FMemHooks.h(59): warning C4091: 'typedef ': ignored on left of 'eMPoolType' when no variable is declared
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(142): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(142): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(142): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(145): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(145): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(145): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(148): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(148): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(148): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(151): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(151): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(151): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(153): error C2143: syntax error: missing ';' before '<'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvGlobals.h(153): error C2238: unexpected token(s) preceding ';'
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvBuilderTaskingAI.h(33): warning C4091: 'typedef ': ignored on left of 'BuilderDirective::BuilderDirectiveType' when no variable is declared
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvCityConnections.h(57): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::RouteState' when no variable is declared
1>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll\CvCityConnections.h(96): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::plotRouteState' when no variable is declared
3>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2039: 'auto_ptr': is not a member of 'std'
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\unordered_map(15): note: see declaration of 'std'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1873): note: see reference to class template instantiation 'CvEnumerator<T>' being compiled
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvUnit.h(1254): warning C4091: 'typedef ': ignored on left of 'CvUnit::Flags' when no variable is declared
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(156): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(156): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(159): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(159): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(162): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(162): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(162): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(165): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(165): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(165): error C2238: unexpected token(s) preceding ';'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(167): error C2143: syntax error: missing ';' before '<'
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(167): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvGlobals.h(167): error C2238: unexpected token(s) preceding ';'
2>_precompile.cpp
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvBuilderTaskingAI.h(33): warning C4091: 'typedef ': ignored on left of 'BuilderDirective::BuilderDirectiveType' when no variable is declared
2>c:\users\marc\source\repos\cvgamecoresource\fireplace\include\fireworks\FMemHooks.h(59): warning C4091: 'typedef ': ignored on left of 'eMPoolType' when no variable is declared
2>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2039: 'auto_ptr': is not a member of 'std'
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\unordered_map(15): note: see declaration of 'std'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamedatabase\include\Database.h(178): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1873): note: see reference to class template instantiation 'CvEnumerator<T>' being compiled
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredllutil\include\CvDllInterfaces.h(1872): error C2238: unexpected token(s) preceding ';'
1>Done building project "CvGameCoreDLL.vs2013.vcxproj" -- FAILED.
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvCityConnections.h(57): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::RouteState' when no variable is declared
3>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion2\CvCityConnections.h(96): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::plotRouteState' when no variable is declared
3>Done building project "CvGameCoreDLL_Expansion2.vs2013.vcxproj" -- FAILED.
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvUnit.h(1176): warning C4091: 'typedef ': ignored on left of 'CvUnit::Flags' when no variable is declared
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(147): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(147): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(147): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(150): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(150): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(150): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(153): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(153): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(156): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(156): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(158): error C2143: syntax error: missing ';' before '<'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(158): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvGlobals.h(158): error C2238: unexpected token(s) preceding ';'
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvBuilderTaskingAI.h(33): warning C4091: 'typedef ': ignored on left of 'BuilderDirective::BuilderDirectiveType' when no variable is declared
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvCityConnections.h(57): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::RouteState' when no variable is declared
2>c:\users\marc\source\repos\cvgamecoresource\cvgamecoredll_expansion1\CvCityConnections.h(96): warning C4091: 'typedef ': ignored on left of 'CvCityConnections::plotRouteState' when no variable is declared
2>Done building project "CvGameCoreDLL_Expansion1.vs2013.vcxproj" -- FAILED.
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========


My first guess is that I should install the 2013 version of Visual C++ instead of the 2017 version, but can someone more experimented confirm this ?

Thank you
 
that guide is outdated ... but we used to have a stickied thread around here also?

anyway, the vp repo already includes the relevant parts of the sdk. but unfortunately those were built with visual c++ 2008 so we have to stay with that version so we don't get linker errors in the end.

so first you need to get the vc 2008 toolset. easiest way is to install visual c++ express. then you can get a more modern version like vs 2017 and install it in parallel.

finally just open the solution file in the vp repo and it should build out of the box.
 
that guide is outdated ... but we used to have a stickied thread around here also?
This thread was as outdated (since it is the one I've used)
It is probably the reason why it is no longer stikied...

Thanks, I will try
 
I've installed VS 2008 Express, and then VS 2017 Community, but VS2017 say that VS2008 is not installed :-(
Am I missing a step? How to say to VS 2017 "it is there"?
 
Yeah, if you want to get a Visual Studio or any kind of C compilation environment on Windows set up, first get yourself a nice pistol and aim it at your brain.
You're in for a headache either way.

You need to install the VC redist packages and the Visual Studios in the right order or they will give you either the error you're talking about, or they won't be able to compile the solution as Gazebo has it. I should have kept track of my fix, but there was no logic to it any way, I just forced it through a scramble of retries.

This is Windows we're talking about here.
 
I've finally manage to reinstall everything and have the v90 tools for compiling with VS2017
However, I still have some errors:

cannot open source file "unordered_map"
cannot open source file "unordered_set"
cannot open source file "array"

(And some other induced errors)

Is there (again) something wrong with my install and I should reinstall everything, or do you know a quicker fix?
Thanks in advance.
 
I've finally manage to reinstall everything and have the v90 tools for compiling with VS2017
However, I still have some errors:

cannot open source file "unordered_map"
cannot open source file "unordered_set"
cannot open source file "array"

(And some other induced errors)

Is there (again) something wrong with my install and I should reinstall everything, or do you know a quicker fix?
Thanks in advance.

Those are missing IDE files for Visual Studios. You have to install 2008, and 2010, and their respective service packs, THEN you can install another VS. Also make sure you don't choose to convert the project when it asks - keep it 2008.

Gah, VS is such a mess.

G
 
Those are missing IDE files for Visual Studios. You have to install 2008, and 2010, and their respective service packs, THEN you can install another VS. Also make sure you don't choose to convert the project when it asks - keep it 2008.

Gah, VS is such a mess.

G
I'm supposed to have installed 2008 then 2010 then 2013 then 2017 (and did not convert anything), but I may have miss one of the associated service pack. Will try again...
 
@Moi Magnus Why do you wanna use VS2017? I am using VS2013 and it's working fine. I tried 2015 and I had problems with it. Anyway, I used visual_studio_express_2013_for_windows_desktop_with_update_4_x86_web_installer.exe. Also, somewhere along the way I had to install VS90SP1-KB976656-x86 to get rid of error C1859. Still don't know what the heck it was...
 
I avoided doing any of this, though I've certainly done the Install VS 2008, 2010, and then the one I want to use. I use VS 2017 enterprise and installed the Windows 7 SDK, there's a certain file(s) of that you have to place somewhere. I'll dig up the instructions I used. It's much cleaner and much easier. You'll get some weird compatibility issues that are no longer operable when you install VS 2008. Frankly, I was happy not having to do that.
 
@Moi Magnus Why do you wanna use VS2017? I am using VS2013 and it's working fine. I tried 2015 and I had problems with it. Anyway, I used visual_studio_express_2013_for_windows_desktop_with_update_4_x86_web_installer.exe. Also, somewhere along the way I had to install VS90SP1-KB976656-x86 to get rid of error C1859. Still don't know what the heck it was...

Because I can't find VS2013 express. I've only found VS2013 professionnal that I can install but cannot use. Every link of VS2013 express I find are either the professionnal, either a redirection to the VS2017 community.
 
Because I can't find VS2013 express. I've only found VS2013 professionnal that I can install but cannot use. Every link of VS2013 express I find are either the professionnal, either a redirection to the VS2017 community.
even my one?
 
I am using VS Community 2017.

Finding all the bits and pieces was a pain but it works. At a guess, I'd say you are missing the Windows 7.1 SDK, which I recall having to jump through a few hoops to get installed - something like temporarily uninstalling some newer .NET components and reinstalling them again after the SDK is installed.

...just based on I remember having to install it and you haven't mentioned it.
 
Back
Top Bottom