|
This thread is locked; no one can reply to it. |
1
2
|
Allegro with wxWidgets |
Samuli
Member #1,837
January 2001
|
Hey. I'm trying to get Allegro and wxWidgets work together in my program, but the program doesn't even compile. The error(s) I get look like this: 1245 C:\Dev-Cpp\include\wingdi.h conflicting declaration 'typedef struct tagBITMAP BITMAP' The same problem was discussed in http://www.allegro.cc/forums/thread/329755/329755#target If I include winalleg.h the error is 203 C:\Dev-Cpp\include\wx\msw\private.h no matching function for call to `RGB::RGB(unsigned char, unsigned char, unsigned char)' but apparently winalleg.h shouldn't be included. I also read through threads And tried to compile the code of the first one with no luck. The error was again with the BITMAP of RBG, depending on if winalleg.h was included. Any thoughts? I'd appreciate any help whatsoever. I can compile plain wxWidgets and Allegro programs. I use Dev-Cpp 4.9.9.2 and mingw32 3.4.2 on WinXP SP2.
|
BAF
Member #2,981
December 2002
|
You have to include allegro and winalleg before wx. |
Samuli
Member #1,837
January 2001
|
I actually had it that way already. As I mentioned, I've tried the sources (that are supposed to work) from the other threads with no success. Maybe I should try wxWidgets with some other library. Too bad none other that I know has easy datafile, bitmap, and sound routines and is cross platform.
|
amarillion
Member #940
January 2001
|
I've never tried compiling a wx-allegro program before, but I've got wxWidgets installed here. If you're willing to share your code I can give it a try. Maybe I stumble upon a solution... -- |
Samuli
Member #1,837
January 2001
|
Well, actually I haven't even made any code of my own (at least nothing I have saved), just trying to compile other peoples code for starters. Just to see if I could compile the damn thing. This is one of the many files I've been trying to compile. It's taken from http://www.allegro.cc/forums/thread/495839 and written by Slazer and modified by BAF. I hope they don't mind me sharing their code (I didn't see a licence agreement, that's what I'll tell them in court.)
|
Felipe Maia
Member #6,190
September 2005
|
I know how to make both compile, just show your code and error and we'll figure it out. [edit] |
BAF
Member #2,981
December 2002
|
What's your problem? It could be your link order. You need -lalleg then the wx stuff. |
Felipe Maia
Member #6,190
September 2005
|
Actually, he's having problem with the definitions of BITMAPs and RGBs, I had the same problem sometime before and managed to compile it, but I lost the code. |
Samuli
Member #1,837
January 2001
|
Felipe, can you make the code in my previous post compile? The error was in the first post, but I assume you mean the whole error message. Here's the compiler log:
So there's something wrong with the RGB thingy..
|
Kitty Cat
Member #2,815
October 2002
|
It appears both Allegro and wxWidgets define RGB. Try this: #define RGB AL_RGB #include <allegro.h> #inlcude <winalleg.h> #undef RGB #include <wx stuff> Then use AL_RGB if you ever need to use Allegro's RGB struct. -- |
Samuli
Member #1,837
January 2001
|
Thanks Kitty, that fixed one problem, but now it gives me following error log (actually this is exactly same error log I get if I use the code above without the line #include <winalleg.h>):
Edit: Felipe: First I'd like to make it work in Windows, but I'd like to leave the door open for cross platforming.
|
FMC
Member #4,431
March 2004
|
Quote: main.cc:5:2: invalid preprocessing directive #inlcude include, not inlcude [FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites] |
Samuli
Member #1,837
January 2001
|
FMC: Blast! No wonder it acted so strangely. Ok, that solves the BITMAP issue, but there's still more to come. Now the problem seems to be in wx's RGB..
|
FMC
Member #4,431
March 2004
|
I think Kitty Cat meant this: #define AL_RGB RGB #include <allegro.h> #inlcude <winalleg.h> #undef RGB #include <wx stuff> not #define RGB AL_RGB //AL_RGB is still not defined #include <allegro.h> #inlcude <winalleg.h> #undef RGB #include <wx stuff>
[FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites] |
Felipe Maia
Member #6,190
September 2005
|
No FMC, Kitty Cat's code is right. Show us your entire code now Samuli. |
Samuli
Member #1,837
January 2001
|
Edit: Ok, so the error is again this 'RGB' undeclared. Man, I'm baffled. Edit: The entire code is there.
|
Felipe Maia
Member #6,190
September 2005
|
Ahhh, I get it now. #define RGB AL_RGB #include <allegro.h> #undef RGB #include <winalleg.h> #include <wx stuff> Change it to this. |
Samuli
Member #1,837
January 2001
|
Errors, errors everywhere.. This time: C:/Dev-Cpp/include/wx/msw/private.h: In function `COLORREF wxColourToRGB(const wxColour&)': C:/Dev-Cpp/include/wx/msw/private.h:203: error: `RGB' undeclared (first use this function) C:/Dev-Cpp/include/wx/msw/private.h:203: error: (Each undeclared identifier is reported only once for each function it appears in.) C:/Dev-Cpp/include/wx/msw/private.h: In function `COLORREF wxColourToPalRGB(const wxColour&)': C:/Dev-Cpp/include/wx/msw/private.h:208: error: `RGB' undeclared (first use this function) Edit: This I got with Felipes latest tips in the previous post.
|
Felipe Maia
Member #6,190
September 2005
|
Hrm, that's odd. |
Samuli
Member #1,837
January 2001
|
Ok, done. Now it gets conflicts with the BITMAP structure. Can you compile the code I've posted earlier? Or maybe with those modifications? Current error: C:/Dev-Cpp/include/wingdi.h:1245: error: conflicting declaration 'typedef struct tagBITMAP BITMAP' C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/include/allegro/gfx.h:234: error: 'BITMAP' has a previous declaration as `typedef struct BITMAP BITMAP' C:/Dev-Cpp/include/wingdi.h:1245: error: declaration of `typedef struct tagBITMAP BITMAP' C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/include/allegro/gfx.h:234: error: conflicts with previous declaration `typedef struct BITMAP BITMAP' C:/Dev-Cpp/include/wingdi.h:1245: error: declaration of `typedef struct tagBITMAP BITMAP' C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/include/allegro/gfx.h:234: error: conflicts with previous declaration `typedef struct BITMAP BITMAP' C:/Dev-Cpp/include/wingdi.h:1245: error: declaration of `typedef struct tagBITMAP BITMAP' C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/include/allegro/gfx.h:234: error: conflicts with previous declaration `typedef struct BITMAP BITMAP' make.exe: *** [main.obj] Error 1 Execution terminated
|
Felipe Maia
Member #6,190
September 2005
|
Hrm, I can't compile because I haven't got both installed, and wxWidgets is too big for me to get just to try. #define RGB AL_RGB #define BITMAP AL_BITMAP #include <allegro.h> #undef BITMAP #undef RGB #include <wx stuff> Try this now. [edit] |
Samuli
Member #1,837
January 2001
|
Now it works! Thanks all! I'm off now to create the greatest spreadsheet computation/action game since MOO3!
|
FMC
Member #4,431
March 2004
|
But doesn't this code: [FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites] |
Felipe Maia
Member #6,190
September 2005
|
It changes the RGB of allegro to AL_RGB, so it doesn't conflict with windows RGB. The problem is that both use the same name. |
FMC
Member #4,431
March 2004
|
but when was AL_RGB defined? [FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites] |
|
1
2
|