[BTS] The Easiest Way to Compile a New DLL

[GRUNTING]
Oh, boy! I hate Win10 so much! I had to change to Win10 recently so I can continue using Zoom and Firefox (and who knows what else). But in the process so much was lost, including my setup for working Visual Studio to compile a dll.
[/GRUNTING]

I followed the instructions of the OP and tried to compile the files I managed to compile successfully on Win7 before but now I get these errors and I'm clueless:

Code:
1>------ Build started: Project: CvGameCoreDLL, Configuration: Release-fast Win32 ------
1>  Building source list
1>  Running fastdep
1>  CvPlayer.cpp
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(18): error C2011: 'CvPathGeneratorBase' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(18) : see declaration of 'CvPathGeneratorBase'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(34): error C2011: 'CvPath' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(34) : see declaration of 'CvPath'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(185): error C2953: 'CvAllocationPool' : template class has already been defined
1>          i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(185) : see declaration of 'CvAllocationPool'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(191): error C2371: 'priorityQueueEntry' : redefinition; different basic types
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(191) : see declaration of 'priorityQueueEntry'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(203): error C2011: 'CvNodeCostInfo' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(203) : see declaration of 'CvNodeCostInfo'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(223): error C2371: 'CvPathContext' : redefinition; different basic types
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(223) : see declaration of 'CvPathContext'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(225): error C2011: 'CvPathGeneratorMT' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(225) : see declaration of 'CvPathGeneratorMT'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPathGenerator.h(314): error C2011: 'CvPathGenerator' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPathGenerator.h(314) : see declaration of 'CvPathGenerator'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(15): error C2365: 'WORKITEM_STATE_NONE' : redefinition; previous definition was a 'enumerator'
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(15) : see declaration of 'WORKITEM_STATE_NONE'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(16): error C2365: 'WORKITEM_STATE_QUEUED' : redefinition; previous definition was a 'enumerator'
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(16) : see declaration of 'WORKITEM_STATE_QUEUED'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(17): error C2365: 'WORKITEM_STATE_PROCESSING' : redefinition; previous definition was a 'enumerator'
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(17) : see declaration of 'WORKITEM_STATE_PROCESSING'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(18): error C2371: 'PipelineWorkItemState' : redefinition; different basic types
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(18) : see declaration of 'PipelineWorkItemState'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(24): error C2011: 'CvPipelineWorkItem' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(24) : see declaration of 'CvPipelineWorkItem'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(77): error C2011: 'CvPipelineStage' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(77) : see declaration of 'CvPipelineStage'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(137): error C2011: 'CvPipeline' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(137) : see declaration of 'CvPipeline'
1>i:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\CvPipeline.h(172): error C2011: 'CvPipelineSyncPointStage' : 'class' type redefinition
1>          f:\games\civilization 4\beyond the sword\mods\chronicles of mankind\cvgamecoredll\CvPipeline.h(172) : see declaration of 'CvPipelineSyncPointStage'
1>  jom: I:\Games\Civilization 4\Beyond the Sword\Mods\Chronicles of Mankind\CvGameCoreDLL\project\Makefile [temp_files\Release\.\CvPlayer.obj] Error 2
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "set TARGET=Release
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake source_list /NOLOGO
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake fastdep /NOLOGO
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: nmake precompile /NOLOGO
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: bin\jom build /NOLOGO" exited with code 2.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I was/am expecting the file path is wrong (disc letters were changed with the Win10 install) but I don't know where to set it up :confused:
 
A full rebuild (Ctrl+Alt+F7; at least that's the shortcut in Visual Studio 2010) is my first idea. So that the old temporary files (.obj) get deleted. Maybe that'll at least produce more helpful errors.
 
With all the redefinitions I suspect the problem is that you somehow compile the headers and include the precompiled header, hence get the same header files twice, but they differ... somehow. Deleting the precompiled header (the .pch file) will likely fix it, but make clean deletes all temp files, including the pch file. Using make clean is a good first step whenever the compiler reports some weird error as it can easily be due to one of the files getting corrupted.
 
Excellent. :)
Tools -> Settings -> Expert Settings should put additional build options on the Debug menu in VS 2010. Personally, I like the frugal Basic Settings, and Rebuild All is the only expert thing that I need frequently, so I've memorized that key combination.
 
Excuse my complete lack of programming knowledge, but I'm trying to do this, but whenever I try to open the .sln file on Visual C# 2010 it cannot be opened as because (.vcproj) isn't supported by the version of the application.

I'm assuming there's some kind of package I have to download for compatibility or something?
 
C# would be the wrong programming language. Iirc the installer let's you choose between Visual C++ and C#, and C++ should be chosen.
 
C# would be the wrong programming language. Iirc the installer let's you choose between Visual C++ and C#, and C++ should be chosen.
Yeah, I was assuming that, but the link in the thread downloaded me visual C#, I'll try the download again or see if there's a C++ version in my files.
 
C# would be the wrong programming language. Iirc the installer let's you choose between Visual C++ and C#, and C++ should be chosen.
Just realised the C++ installer is in my files. I have no clue how I ended up with the C# version... Anyways...
 
C# would be the wrong programming language. Iirc the installer let's you choose between Visual C++ and C#, and C++ should be chosen.
Okay, I'm downloading the C++ version, but I'm still getting a problem where it's failing to establish server connection when I try to install it. I'm current running with administrator so that shouldn't be the problem. Do you have any idea what causes this?
 
Good. Ftr, my modus operandi would be to extract the ISO from the opening post (using e.g. WinRAR) and to run the setup.exe in the VCExpress folder. That gives me a dialog offering to uninstall, repair or enhance my existing installation of Visual C++ 2010 Express. Don't know if there's anything troublesome beyond this point.
 
Unfortunately my 2010 Visual Studio 30 day without registration thing has ended, and because, well, Microsoft doesn't support VS 2010 anymore, there seems to be nothing I can do to register...

Does anyone know if there's a fix to this, or alternatively, a different option? I've tried Build->CivGameCoreDLL on VS2022, but idk, it doesn't seem to work.
 
Do you have a microsoft account? In visual studio you just need to login into it. There is no special register. Maybe it was different in vs 2010, cannot remember.
 
Do you have a microsoft account? In visual studio you just need to login into it. There is no special register. Maybe it was different in vs 2010, cannot remember.
Yeah, you have to register by entering a (15 digit I believe) code, but the link no longer works, since VS 2010 is no longer supported by Microsoft.
 
This.
 

Attachments

  • image.jpg
    image.jpg
    6.3 MB · Views: 141
Visual Studio 2010 isn't required and can be replaced by another version. Only Visual Studio 2003 has to be that specific version as that is what was used to compile the exe file and memory allocations can mess up if you mix versions.

In other words if VS2010 fails for whatever reason, you can work around it by downloading the newest visual studio, which currently is the 2022 version. Currently I'm using the 2017 version, but I have been considering upgrading to 2022. The newer versions just work better when proposing code completion, list available functions and similar features. Since the 2003 version does the actual compilation, the resulting DLL file will be unaffected by which version of visual studio you use.
 
I've been experiencing a strange issue building the SDK. I had a git repo setup with my SDK components etc and it had a messy history, and didn't include my mod's Assets. I decided over the weekend to clean the whole repo up and include my Assets. I copied the source repo it to a new repo for a fresh history.

The new repo builds the SDK no problem. When I run Civ4 and load the mod. The splash screen passes all the xml and python parses or whatever else the splash screen does, then, in normal process, the screen goes black for half a second and then displays the Civ4 in-game menu. But the screen instead stays black for 3-4 seconds and then Civ4 closes without error/warning - black screen of death. This error never happened with the old repo. But since this issue has started occurring, it does now occur if I build from the old repo.

From previous experience with some other unrelated program (in VB6), I had a hunch that the DLL needs registering, and therefore opening the DLL (CvGameCoreDLL.dll) in Notepad++ would be enough to register it. Apparently this worked. After opening and closing the DLL in Notepad, I can launch Civ4 with the mod and it opens I can start games and play without issue. But just once. If I close the game, it will revert to doing the Black Screen of Death. And the only way I know how to get it working again, is to rebuild the SDK, open and close in Notepad again, but again it only works once. Could be a red herring, but I feel it's got something to do with registering the DLL and the way I delete/copy/replace the DLL via either the makefile or batch file, because I use a batch file to copy my Assets from my git repo to Civ4 mods. Before I go down a rabbit hole of further investigation, perhaps someone is familiar with such issues?
 
Back
Top Bottom