Hello everyone,
im new to Allegro and have a question concerning setting up my IDE.
After fallowing the introductions in this thread
http://www.allegro.cc/forums/thread/605784
i tried to compile this code
and got these errors
Compiling: main.cpp
Linking console executable: bin\Debug\Allegro_Test.exe
obj\Debug\main.o: In function `main':
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:8: undefined reference to `al_install_system'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:13: undefined reference to `al_create_display'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:19: undefined reference to `al_map_rgb'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:19: undefined reference to `al_clear_to_color'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:21: undefined reference to `al_flip_display'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:23: undefined reference to `al_rest'
E:/C++/Projekte/Allegro_Test/Allegro_Test/main.cpp:25: undefined reference to `al_destroy_display'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
7 errors, 0 warnings
In this thread
http://www.allegro.cc/forums/thread/605768
Matthew Leverton said that liballegro-5.0.0-RC2-md.a (liballegro-5.0.0-RC4-md.a in my case) needs to be linked.
Isn't that already done by adding the allegro\lib path to the Linker Directories?
If not how do i link it?
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.
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.
If not how do i link it?
Add it to the list of libraries to link. Your IDE will have that option somewhere.
Thanks Matthew,
I found the option under Project -> Build Options -> Linker Settings
@Hedgie: If you use Code::Blocks
Go to Settings / Compiler and Debugger / Global compiler settings
Go to Search Directories tab
Under Compiler, add c:\allegro\include
Under Linker, add c:\allegro\lib
Go to Toolchain executables tabs
Under Additional Paths, add c:\allegro\bin
and then link the liballegro-5.0.0-RC4-md.a as i said above
good luck^^
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.
to `glGetString@4'
d:/Libraries/build/allegro/src/allegro-5.0.x/allegro-5.0.x/src/win/wgl_disp.c:1044: undefined reference to `glGetString@4'
Process terminated with status 1 (0 minutes, 1 seconds)
50 errors, 0 warnings
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.
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++.
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.
Something like -lglu32 -lglut32 -lopengl32.
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.
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?
@Matthew Leverton
My bad I phrased that wrong
, I do use code::blocks but I remember Dev C++ had some nice integrated library installing feature. I have the exact same problem as Xero
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?
Ok i lied my problems different, it was the same for a while though nut now its this
and the errors i get are
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.
Don't use END_OF_MAIN with Allegro 5.
Thank you kind sir,
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
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:
-s -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD
Switches for linker:
-lgcc_eh -static-libgcc -static-libstdc++
Switches for executable:
Switches for source files:
-s -DALLEGRO_STATICLINK
Switches for linker:
-lgcc_eh -static-libgcc -static-libstdc++
Libraries:
Allegro and add-ons (list all your application, you may list all they will be ignored if not used):
allegro-5.1.0-static-mt
allegro_audio-5.1.0-static-mt
...
Direct dependencies (libraries used by Allegro):
libFLAC-1.2.1-static-mt
libvorbisfile-1.2.3-static-mt
libvorbis-1.2.3-static-mt
libogg-1.1.4-static-mt
dumb-0.9.3-static-mt
zlib-1.2.5-static-mt
physfs-2.0.0-static-mt
freetype-2.4.2-static-mt
Indirect dependencies (DLL's availabe in system):
gdiplus
uuid
kernel32
winmm
psapi
opengl32
glu32
user32
comdlg32
gdi32
shell32
ole32
advapi32
ws2_32
If someone knows how to use this information please post it...
I'm using Code Block...
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...