Compiling Irr with Allegro and Win32 API

Discussion about everything. New games, 3d math, development tips...
Post Reply
Guest

Compiling Irr with Allegro and Win32 API

Post by Guest »

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?
Guest

Post by Guest »

You'll have a VERY hard time trying to do it. Use the Audiere or OpenAL libraries for sound with Irrlicht. Much simpler...
hybrid

Post by hybrid »

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.
Alberto Rubinato

Post by Alberto Rubinato »

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
Alberto Rubinato

Post by Alberto Rubinato »

Now, you can also use Allegro.Net

http://www.skorzec.com/allegnet/
cpprules
Posts: 148
Joined: Wed Jul 27, 2005 8:37 pm
Location: on the Pedastal

Post by cpprules »

If sound is the only reason, i highly reccomend you not to use Allegro!
Try FMod, or something.
CRPG, FRPG, Oblivion Fan
Hater of Counter Strike (i hate it so much damn it)
Post Reply