|
|
| Code::Blocks Linker Problem |
|
_Xero_
Member #12,472
December 2010
|
Hello everyone, http://www.allegro.cc/forums/thread/605784 i tried to compile this code 1#include <stdio.h>
2#include <allegro5/allegro.h>
3
4int main(int argc, char **argv)
5{
6 ALLEGRO_DISPLAY *display = NULL;
7
8 if(!al_init()) {
9 fprintf(stderr, "failed to initialize allegro!\n");
10 return -1;
11 }
12
13 display = al_create_display(640, 480);
14 if(!display) {
15 fprintf(stderr, "failed to create display!\n");
16 return -1;
17 }
18
19 al_clear_to_color(al_map_rgb(0,0,0));
20
21 al_flip_display();
22
23 al_rest(10.0);
24
25 al_destroy_display(display);
26
27 return 0;
28}
and got these errors Compiling: main.cpp In this thread |
|
Hedgie
Member #12,494
January 2011
|
Getting Allegro to play nice or any library for that matter always seems to make me stumble too. I searched and read all kind of material over the internet to try and get RC4 to work but just can't seem to figure out what I'm doing wrong. I have read through the various threads here and none of them seem to help. Just a note I've pretty much done the same as Xero and am still having some of the same issues. |
|
Matthew Leverton
Supreme Loser
January 1999
|
_Xero_ said: Isn't that already done by adding the allegro\lib path to the Linker Directories? No. That just tells the compiler where to look for libraries that you explicitly specify later. Quote: If not how do i link it? Add it to the list of libraries to link. Your IDE will have that option somewhere. |
|
_Xero_
Member #12,472
December 2010
|
Thanks Matthew, @Hedgie: If you use Code::Blocks Go to Settings / Compiler and Debugger / Global compiler settings and then link the liballegro-5.0.0-RC4-md.a as i said above good luck^^ |
|
Hedgie
Member #12,494
January 2011
|
Okay so part of the problem is figured out if I use the library file "liballegro-5.0.0-RC4-md.a" I can get the first allegro 5 tutorial(The display one) to compile just fine. But what I'm really going after is trying to use "liballegro-5.0.0-RC4-monolith-static-mt.a" and "liballegro-5.0.0-RC4-monolith-static-mt-debug.a" and when attempt to compile using one of the two file Codeblocks seems to treat the file differently. I even make sure to define ALLEGRO_STATICLINK before all my headers and get various errors. This particular one is straight out of my build log. The other 50 errors Pastebin Note: The libraries aren't located on my D: drive they're in my J: drive making me wonder if there is something wrong with the library itself. |
|
Fworg64
Member #12,077
June 2010
|
Please help, Same problem. I'd be willing to switch IDE's if anyone knows one that plays nice with allegro other then Dev C++. I know what I'm doing, I'm just not very good at it. -Austin Oltmanns |
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
When linking statically, I think there are several other libraries that you have to link to as well. For instance, it looks like you're not linking to the OpenGL library according to your undefined reference to glGetString@4. It looks like there are other libraries you have to link to as well according to your log on pastebin. Can someone post a list of the extra libraries that you need to link to when you're linking with Allegro5 statically please? I googled for them, but came up with nothing in the manual or documentation or forums. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|
Matthew Leverton
Supreme Loser
January 1999
|
Something like -lglu32 -lglut32 -lopengl32. Fworg64 said: I'd be willing to switch IDE's if anyone knows one that plays nice with allegro other then Dev C++. This has nothing to do with Dev-C++, but Code::Blocks is generally preferred over it. |
|
Hedgie
Member #12,494
January 2011
|
Another note to put in here is I was using TDM-mingw and while everything has compile just fine, it seems that Allegro 5 and TDM-mingw is incompatible in some way at the moment. I'm getting the official Mingw right now but if this isn't some kind of mistake on my end maybe this needs to be documented? Okay nevermind, I'm getting the same error with mingw as with TDG-mingw. The program compiles just fine but when I go to run it I get a window with this message "The procedure entry point __gxx_personality_v0 could not be located on the dynamic link library libstdc++-6.dll" I really have no clue what this message is trying to explain at all. This is the first of this kind of error I've ever seen. Any advice? |
|
Fworg64
Member #12,077
June 2010
|
@Matthew Leverton I know what I'm doing, I'm just not very good at it. -Austin Oltmanns |
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Fworg64 said: I have the exact same problem as Xero If you are getting undefined references during the linking process, then you are not linking all of the libraries that you should be. What undefined references are you getting? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|
Fworg64
Member #12,077
June 2010
|
Ok i lied my problems different, it was the same for a while though nut now its this 1#define ALLEGRO_STATICLINK 1
2#include <allegro5/allegro.h>
3
4int main(void)
5{
6 al_init();
7
8 ALLEGRO_DISPLAY *display = al_create_display(640, 480);
9
10 al_clear_to_color(al_map_rgb(0, 150, 0));
11
12 al_flip_display();
13
14 al_rest(5);
15
16 return 0;
17}
18END_OF_MAIN()
and the errors i get are 1main.cpp|8|warning: unused variable 'display'|
2C:\C++ projects\Alleg5test\main.cpp|18|error: expected constructor, destructor, or type conversion at end of input|
I can guess the first one is just because i didn't say display anywhere else in main but I'm at a loss for that last one, I've tried with and without a semicolon but to no avail. I know what I'm doing, I'm just not very good at it. -Austin Oltmanns |
|
Matthew Leverton
Supreme Loser
January 1999
|
Don't use END_OF_MAIN with Allegro 5. |
|
Fworg64
Member #12,077
June 2010
|
Thank you kind sir, I know what I'm doing, I'm just not very good at it. -Austin Oltmanns |
|
AMCerasoli
Member #11,955
May 2010
|
Edgar Reynaldo said: Can someone post a list of the extra libraries that you need to link to when you're linking with Allegro5 statically please? We're more or less on the same problem... See this threat... http://www.allegro.cc/forums/thread/606040/0 Michał Cichoń Once says... Here http://www.allegro.cc/forums/thread/605692 Michał Cichoń said: Assume you're using MinGW GCC 4.5.0. To compile Allegro as static library with static run-time libraries use following switches: Switches for source files: Switches for executable: -lgcc_eh -static-libgcc -static-libstdc++ Libraries: Direct dependencies (libraries used by Allegro): libFLAC-1.2.1-static-mt Indirect dependencies (DLL's availabe in system): gdiplus
If someone knows how to use this information please post it... I manually linked to the Indirect Dependencies, which are all in the System32 folder... But I couldn't find "uuid.dll" and I still getting errors... I'm using the pre-build static binaries... I did this... http://www.cerebrospain.com/find5.gif PS: You must link manually all those libraries if you want to compile statically...
|
|
|