Compiling Irr with Allegro and Win32 API
Compiling Irr with Allegro and Win32 API
Hi all. I'm making a game and am using Irrlicht for GFX, and Allegro for sound (allegro has some nice panning/volume freatures). The hard part is, I also will need to be able to include windows.h (the GCC/DevCPP version) and both Allegro and Win32 API have a "BITMAP" stucture, causing compile errors. Are there any workarounds for this?
If allegro offers namespaces you can avoid the problem by removing the 'using namespace' statement. Otherwise use a define which renames the allegro bitmap. Yu have to define a new name for bitmap before the includes for allegro and undef it afterwards. Note that you have to use the changed name even though you undef'd it. Can cause incompatabilities, but I don't think that allegro's including windows headers itself.
Hi, I used Allegro for two years and encountered the same problem the first time. Just read Windows specific topic in Allegro FAQ. This case is enounced, and is very simple to go out of it.
I report you the solution:
------------------------------------------------------------------------------
I get lots of compile errors about conflicting types for "struct BITMAP"!
If your program directly includes Win32 API header files, see the "Windows specifics" section of the documentation.
If your program only includes header files of the C++ standard library, you're very likely trying to compile it with gcc 3.x for MinGW; if so, define the symbol __GTHREAD_HIDE_WIN32API on the compiler command line:
g++ -D__GTHREAD_HIDE_WIN32API program.cpp -lalleg
I report you the solution:
------------------------------------------------------------------------------
I get lots of compile errors about conflicting types for "struct BITMAP"!
If your program directly includes Win32 API header files, see the "Windows specifics" section of the documentation.
If your program only includes header files of the C++ standard library, you're very likely trying to compile it with gcc 3.x for MinGW; if so, define the symbol __GTHREAD_HIDE_WIN32API on the compiler command line:
g++ -D__GTHREAD_HIDE_WIN32API program.cpp -lalleg