I'm working on an application written in C that's supposed to run on at least Linux and Windows. I usually work on Linux, so I'd like to be able to cross-compile my application for Windows.
My current setup:
- Debian GNU/Linux amd64
- No complex build system, just a simple Makefile
- Using GCC for Linux, MinGW for Windows
My application depends on a number of libraries. Luckily, my distribution offers development headers, so compiling for Linux works pretty much out of the box using pkg-config to determine CFLAGS and LDFLAGS.
It doesn't work that well for Windows. My distribution provides a compiler toolchain for x86_64-w64-mingw32, which is able to find the development headers, but for some libraries I need different versions for Windows. Unfortunately, these versions are not provided by my distribution so I have to install them on my own.
So: Where do I install the development headers for Windows? How do I make pkg-config find it? Is there a way to just compile for Windows using a single command, just like I can compile for Linux by calling
In my case, one of the libraries in question is SDL2. Trying to compile with the headers shipped by my distribution produces a
fatal error: iconv.h: No such file or directory. Googling for this error also tells us to use the Windows version. Other libraries seem to work during the compiling stage, but obviously it can't find them during the linking stage.