Successful Visual Studio 2015 dev setup?

Hey everybody.
I found this game about a week back and got absolutely hooked.

I started this thread on reddit:
I’ve got a linux machine at home and do have some experience with linux as a work environment from my previous job (but it was quite well prepared so we mostly could focus on bug fixing), and at home I mainly sit by my Windows computer and I’ve worked with VS a few years ago and really liked it, so I was wondering if it would be doable to set up VS 2015.
I found and tried to follow this, setting up VS2015 and everything from scratch:


There were a few issues, such as some includes expecting all SDL-files residing in an SDL2 folder, some expecting to be found in the root of some include folder.
The pre compile script tries to use LUA to autogenerate some code. I of course didn’t have LUA on my computer so I had to shove that in.
I downloaded and built the gettext-msvc at after changing a couple of things mentioned in a 1 year old still open issue (the only issue).
(The comments by petermorck are mine.)
In Cataclysm I got an error about an unknown file by [tt]#include <libintl.h>[/tt] in [tt]translations.h[/tt] and [tt]main.cpp[/tt]
There file [tt]libintl.h[/tt] doesn’t exist anywhere.
I figured it might be the [tt]libgnuintl.h[/tt] in gettext, so I change those includes to use that instead.

Finally I actually got past the compilation stage and then the linker started puking at me.
It was of course a bucketload of
[tt]error LNK2001: unresolved external symbol libintl_gettext[/tt]

I then look at the built libintl.lib and see this:

[code]>dumpbin /EXPORTS libintl.lib


Note how there’s no [tt]libintl_[/tt] in front of [tt]gettext[/tt].
So it’s trying to find [tt]libintl_gettext[/tt] but the lib only exports [tt]gettext[/tt].
Looking at the [tt]libgnuintl.h[/tt] and the redirect stuff in there made my brain hurt and I just gave up…
Anybody know how to get past this (last?) step? (It actually complains about LUA references too, but… later problem…)

Has anybody managed to set up VS2015 as a working dev environment for this game?

I finally got it to work somewhat. It’s kind of a dirty setup, but it worked…
To clarify I’m using Visual Studio 2015 Community.
Sorry if this is a super long and messy guide, but maybe reading it will help someone else set VS2015 up.
There may also be errors as I did this over the course of 2 days, usually in the evening and after midnight, and I tried a lot of things so I might not be 100% sure exactly which step was the correct one…
The order I describe this in is likely not the same order I tried everything in…

Anyway, this is a good place to start

I started with the project to build an x64 Release.

It was a bit messy with the include paths and libs. For instance it expectes all SDL h-files to be in the same directory and it has to be called SDL2. Because:
In [tt]stdafx.h[/tt] you find:

[code]# include <SDL2/SDL.h>

include <SDL2/SDL_ttf.h>

include <SDL2/SDL_image.h>

if defined(SDL_SOUND)

include <SDL2/SDL_mixer.h>

and in [tt]cata_tiles.h[/tt] you see:

So you either change the code, or need to have add two paths to the include dir paths in the project config (path to SDL2 folder and path into SDL2 folder).
However getting the SDL h-files and libs in order were the easiest part. Just download and place them where the compiler/linker is looking for them and fix the paths.

I noticed, the first thing in the build output the compiler begins by running LUA to generate a cpp file. The instructions tell you how to compile the library but don’t mention need for an executable.
This I had to download. I think I got this one:
and then just unpacked the archive in [tt]src\lua[/tt] where it seemd to look for it renamed the executable to [tt]lua.exe[/tt]. That got past the first code generation step.

Building LUA lib was a bit messy.
The instructions tell you to how to compile it, but VS2015 (my installation at least) defaults to the x86 compiler.
To fix this there’s a bat script you can run to setup x64 compilation.
There are 32-bit compilers and 64-bit compilers for 32-bit targets and 64-bit targets, and depending on which one you want to use it seems you should run the corresponding setup script.
They all begin with the name [tt]vcvars[/tt].
In my case, I tried running this:
[tt]C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat[/tt]
which means run a 32-bit executable and create 64-bit target (which is what I needed).

After running that, I then followed the instructions I found here:
which seem to be really close to the compilation guide, but it uses a couple more arguments.
Rename the lib and DLL files as required.

Leave the [tt]#include <libintl.h>[/tt] as is. Don’t change it like I first did in the post above.

Downloading and compiling gettext was a bit of a mess as well.
Please see:

It then seemed to compile fine, but I had problems getting libintl to work so I instead eventually downloaded the stuff from
In my case:
Rename as required.
The libiconv lib and dll were however usable.
I THINK that was it.
Of course when I tried to run it I then had to copy all the DLLs (SDL, libiconv, etc…) to where Cataclysm.exe was created.
I also had to find and download [tt]libfreetype-6.dll[/tt] which I got from here:

In case I forgot any library or DLL it’s probably easy to see what it is and just copy it to the project root folder.

I then decided to change to Debug x64 to do the debugging stuff.
The include paths and library paths were copied from the Release x64 config.
I got a new compiler error now for some reason. I don’t remember exactly what it was, but it seemed like more of a warning. This could be ignored by adding [tt]_SCL_SECURE_NO_WARNINGS[/tt] to the preprocessor definitions in the project config.

Also, pay close attention to this:
The VS project file is NOT in the same folder as the Cataclysm.exe, so you need those two [tt]…[/tt] added to make it work.

After all that I could FINALLY build and debug!

A minor annoyance is that the ^-key works differently when I compile myself. In the pre-built downloaded binaries it works with a single keypress, but when I build myself I have to press the key twice. It’s this key that makes you write ô and stuff like that, so it just eats the first keypress. I don’t know why that differs, but… meh…

Again, sorry for the messy “instructions”.

This was awesome, thanks. I’ve nearly got my own dev env up and running, but I’ve hit a snag.

I’ve added all the SDL stuff and setup Lua correctly (I think) thus far, but I now have loads of

“unresolved external symbol libintl_gettext”


I downloaded the two gettext libraries you linked and pointed the project to the includes and the libs, but it still doesn’t work. I’m not really sure where I’m going wrong at this stage. Do you have any ideas?

Nevermind, figured it out.

For some reason, the libintl.lib generated by the project pointed to in the compile instructions doesn’t seem to work at all. I downloaded the 32-bit versions of the same libraries you used and took the lib file from there (I had to rename intl.lib to libint.lib) then pointed the project to it and it worked fine.

Very odd. Perhaps the compile instructions should be updated?

I am still in progress on building Cataclysm on VS 2015 and I multiple multiple errors that explainable.
But some of them seems strange. It is errors like:
“1>…\src\worldfactory.cpp(1475): error C2668: ‘read_from_file_optional’: ambiguous call to overloaded function”

Is is actually connected with building?

Looks like there is must be explicit cast.
So here I see 2 things:

  1. Possible it works for linux compilers. I mean they don’t get this error.
  2. All cataclysm devs use linux to work with source. Right?

So it maybe even it is not worth it to try it on Windows because main development platform for Cataclysm is Linux. I mean if I continue trying on Windows then I’ll always get that kind of problems and I always must fix/change source in fututre. It is kinda not fun at all.

So Linux is way to go?

I use Windows at the moment.

Still, even on Windows, we only really support GCC, such as the one bundled in latest Codeblocks. GCC is much lighter than a VS2015 installation.

If someone can make DDA compile in VS2015, it would be nice to PR the relevant changes with a doc describing what has to be done to get a basic (console, no localization) build compiling.
Though as long as it gets it to compile without making too much of the code ugly, it can be merged just fine if a non-dev can confirm it works.

this is the only place on the internet that got me close to the successful build…
close to
still i cannot build, because of the problems related to the ambiguous overloaded function and other errors.

Also my folder has tons of dlls, libs, sources of other packages and i have absolutely no idea of what is linked to what anymore.

the how to compile document is seriously outdated: isn’t there a way to avoid building the external libraries ? is there an easier way to let new devs to provide some help?

Stormsson2, I feel your pain dude. I’m on windows too, can’t compile the game myself too. I’ve tried a lot of setups, have read most forum posts, git doc, but I’m too much of a newbie yet to make-build big projects like cata, I guess.

Hopefully I’ll try again in soon. :smiley: Can’t help myself to try hard to become a contributor too. :smiley:

MSYS2 used to be the easiest way to compile on Windows. It might still be.

I’m using MSYS2. It’s not trivial, but the old tutorial still works, I think.

The easiest way is CodeBlocks, but it won’t work with tiles out of the box. And it produces very slow builds for some reason. Still, it is enough to test code changes.

I’ve never really had too much trouble with CDDA myself. I always use Visual Studio but I’m also here only once every 2-3 months. I mean its no picnic but most issues can be worked around in 1-2 hours of work each update (which is probably still too much). Unfortunately my personal build has a number of changes that have either been rejected (i.e. tinymap on heap rather than stack) or are something I’m 100% comfortable releasing due to lack of testing (workaround for VC2015 lack of support for stack allocated dynamic arrays) or would be new features (alternate vehicle part graphics) which may actually be a feature implemented differently.

Regarding gettext/iconv/libintl, I think I had to make 2 changes in the config.h related to mbstate_t. Maybe I’ll create a new fork and merge the changes and do a PR if the offer to integrate is still present. You’ll have to decide if you want to keep the changes like dynamic stack array or not.

Edit: I created a pull request for changes. I created a separate props file to isolate dependencies and make it easier to change folders and stuff. I did not check in any libintl fixes but I did have to change the config.h for mbstate_t as indicated above and also used a .def file to force several functions to be exported from the libintl dll which was not being done by default due to how macros were redefining function names. If people need that I can probably just show a diff.

This is the list of Visual Studio 2015 changes I made to get CDDA to compile with fewer warnings and errors. Several are warnings that might compile like double to float casts or use bad operators like + on booleans.

Major issues were the read file function casting with bind not automatically sorting out which version of the override to use. I removed some Dynamic Array work since that seems to have changed recently so that dynamically sized stack allocated arrays are not used any more. Though I worry about my_MAPSIZE vs MAPSIZE potential differences which could in theory lead to buffer overflows.

I changes some include locations related to SDL2 because the source libraries do not actually use that folder convention so I don’t believe this project should require moving files around just so that SDL2 is prefixed.

My headers/binaries used for WinDepends folder can be found in the release notes at