# Building on Windows with MingW, and dealing with libintl\_gettext errors

**URL:** <https://discourse.cataclysmdda.org/t/building-on-windows-with-mingw-and-dealing-with-libintl-gettext-errors/2521>\
**Category:** The Toolbox\
**Created:** [August 3, 2013, 4:23am UTC](https://discourse.cataclysmdda.org/t/building-on-windows-with-mingw-and-dealing-with-libintl-gettext-errors/2521 "2013-08-03T04:23:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seth](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/seth/32/995_2.png) [@Seth](https://discourse.cataclysmdda.org/u/Seth)\
**Post date:** [August 3, 2013, 4:23am UTC](https://discourse.cataclysmdda.org/t/building-on-windows-with-mingw-and-dealing-with-libintl-gettext-errors/2521/1 "2013-08-03T04:23:45Z")

</div>

It’s a work in progress, but I’m working on an [updated makefile for MingW](https://dl.dropboxusercontent.com/u/94402298/Makefile.mingw) based on the default Makefile, which supports both SDL and non-SDL builds and deals with undefined reference errors related to libintl\_gettext.

This assumes you’ve already installed Cataclysm’s dependencies ([SDL](http://www.libsdl.org/), [SDL\_ttf](http://www.libsdl.org/projects/SDL_ttf/) and [freetype](http://freetype.org/download.html)if you want tiles) and have at least a little experience using MingW. I’d recommend installing the [GNUWin32](http://gnuwin32.sourceforge.net/) package since it contains fully native ports of several libraries used by Cataclysm, along with others that may be of use in the future. I haven’t tested this with the version of libintl that comes with MingW, as I replaced it on this machine a while ago.

To build, copy [makefile.mingw](https://dl.dropboxusercontent.com/u/94402298/Makefile.mingw) to the project’s root folder, open a command window there and type:

```auto
make -f makefile.mingw
```

For the SDL version:

```auto
make TILES=1 -f makefile.mingw
```

For optimizations, add RELEASE=1 (default level is -O2, -Og if DEBUG is defined).  
The primary addition to the makefile is -DLIBINTL\_STATIC. In libintl.h, this can cause trouble:

`#ifdef LIBINTL_STATIC
#define LIBINTL_DLL_EXPORTED
#else /* LIBINTL_STATIC */
#ifdef BUILDING_LIBINTL
#define LIBINTL_DLL_EXPORTED __declspec(dllexport)
#else
#define LIBINTL_DLL_EXPORTED __declspec(dllimport)
#endif
#endif /* LIBINTL_STATIC */ `

[The errors found here](https://github.com/CleverRaven/Cataclysm-DDA/issues/1856#issuecomment-21001370) relating to libintl\_gettext are the result of the linker looking for static implementations which are hidden by default. Luckily, it’s a simple enough fix. Either:

- avoid statically linking to libintl, or
- define LIBINTL\_STATIC.

A couple of issues, as of this posting: O3 optimization is still causing a segfault when the player tries to construct something. And at least on this machine, compiling with MingW appears to completely break the frame rate. I’m anxious to figure that one out.

Please let me know how it works, especially if it doesn’t. 🙂
