Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Compiling for windows from Linux with mingw: allegro.h no such file or directory

This thread is locked; no one can reply to it. rss feed Print
Compiling for windows from Linux with mingw: allegro.h no such file or directory
dusthillresident
Member #16,778
December 2017

Hello,

I'm writing a game using Allegro 4.
It compiles and works well on linux with GCC.

I want to compile my game for windows so other people can play it.
I have mingw installed and I'm able to compile simple 'hello world' type programs with i686-w64-mingw32-gcc, but I can't compile any software that uses allegro, I get the error 'allegro.h not found'

What I've tried doing so far:
I downloaded the allegro-4.4.2 sourcecode and extracted it into a folder, and I tried these commands:

i686-w64-mingw32-gcc test.c -Iallegro-4.4.2/ -Lallegro-4.4.2/ -lalleg
i686-w64-mingw32-gcc test.c -Lallegro-4.4.2/ -lalleg
i686-w64-mingw32-gcc test.c -Iallegro-4.4.2/ -lalleg

They all gave me the 'allegro.h not found' error.

Then I tried changing to the allegro-4.4.2 directory and running this:

i686-w64-mingw32-gcc test.c -Iinclude/ -lalleg

This gave me a different error,

include/allegro/internal/alconfig.h:36:44: fatal error: allegro/platform/alplatf.h: No such file or directory

So just to see what would happen, I went and renamed alconfig.h.cmake to alconfig.h and then I got a screen full of messages like this:

include/allegro/platform/alplatf.h:1:2: error: invalid preprocessing directive #cmakedefine
 #cmakedefine ALLEGRO_BCC32

Anyway, what should I do? Does anyone here have experience building allegro programs for windows targets on Linux systems?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

dusthillresident
Member #16,778
December 2017

Thanks. How would I build the binaries?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

dusthillresident
Member #16,778
December 2017

There doesn't seem to be a make command specifically for mingw32. How would I tell 'make' to compile using the mingw equivalent gcc and other mingw tools?

Edit:
I'm not sure this is going to work at all, so I'm installing the windows version of mingw on another computer that has windows 10. Hopefully I'll have more luck with that.

Edit: After a lot of trouble I got it to work.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

dusthillresident
Member #16,778
December 2017

After installing mingw in windows, I needed to install cmake. Then I worked out how to use cmakegui, I had to give it the paths to mingw's gcc and g++ commands.

Then compiling allegro4 failed because some files related to DirectX had slightly wrong variable/constant names for some reason, so I had to manually search & replace until it compiled.

Then I had to work out what command options I needed to give to gcc in order to make it compile my own game program. I eventually worked that out by looking at the CMakeList files for the example programs.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: