|
|
| Linking Libraries for Dummies |
|
Aaron Whipple
Member #4,001
November 2003
|
I'm a coder with a significant amount of experience, however the one area that I literally know nothing about is linking libraries. I have been trying to set allegro up in Code Blocks and mingw and I am drawing blanks. Ive been searching for guides and many of them say I need to build allegro. Is that really necessary? I would think there was a pre-compiled version to use. Another site said that I needed subversion at which point I quickly clicked my back button, as I cant see how source control has anything to do with it... To get to the point, I don't want a step by step guide to setting up Allegro. What I really need is a good resource to start learning about linking libraries in general so I can do it myself in the future without having to ask for help. Any recommendations are greatly appreciated. Thanks in advance! P.S. Is Allegro 5 stable? I couldn't find information on whether I should start with 5 or just stick with 4 right now. |
|
gnolam
Member #2,030
March 2002
|
Aaron Whipple said: What I really need is a good resource to start learning about linking libraries in general so I can do it myself in the future without having to ask for help.
There isn't mich to say on that topic other than "link with the library in question and its dependencies, with whatever extra linker flags are needed". -- |
|
Aaron Whipple
Member #4,001
November 2003
|
I suppose the trouble I have is locating good documentation for individual libraries then. The version of Allegro 5 I downloaded had no documentation... |
|
MiquelFire
Member #3,110
January 2003
|
I don't know about the MinGW version, but on MSVC, you just add the normal Allegro libraries you need (if you're using the DLL version) and just accept the default libs MSVC puts in anyway. I don't know what the extra libs for static linking are however. But I do know you need to define ALLEGRO_STATICLINK (or something like that) in your project. --- |
|
Matthew Leverton
Supreme Loser
January 1999
|
Aaron Whipple said: P.S. Is Allegro 5 stable? I couldn't find information on whether I should start with 5 or just stick with 4 right now. Use version 5 RC2. The files page here will have appropriate build / setup documentation by the time version 5.0.0 is out. Until then you'll need to look up the wiki for info or read the installation instructions that come with the source. The API manual is online. |
|
Aaron Whipple
Member #4,001
November 2003
|
Thanks for all the help everyone. I managed to get version 4 working. Now I just need to find a pre-built version of 5. I think I am beginning to understand this whole linking thing a bit now |
|
Thomas Fjellstrom
Member #476
June 2000
|
Aaron Whipple said: Now I just need to find a pre-built version of 5 http://www.allegro5.org has A5 binaries. -- |
|
Matthew Leverton
Supreme Loser
January 1999
|
Aaron Whipple said: Now I just need to find a pre-built version of 5. http://www.allegro.cc/files has A5 binaries. But maybe you should check under your bed first. |
|
Aaron Whipple
Member #4,001
November 2003
|
Surprise! I'm back again. I successfully got Allegro 4 working. I am now trying to set up allegro 5 though and have run into a problem. I downloaded Allegro 5.0.0 for Mingw 4.4.0. I linked in the same way as allegro 4 was linked (lib and include folders) and used liballegro_main-5.0.0-RC2-md.a It seems to recognize the include file alright, but once I compile the following code, I get errors. Ive already spent the last couple hours searching around for any indication of what I may have done wrong. [code] int main(int argc, char **argv) if(!al_init()) { display = al_create_display(640, 480); al_clear_to_color(al_map_rgb(0,0,0)); al_flip_display(); al_rest(10.0); al_destroy_display(display); return 0; obj\Release\main.o:main.cpp|| undefined reference to `al_install_system'| I also attempted to compile a much simpler program, only calling al_init to minimize potential problems. Same issue though. |
|
Matthew Leverton
Supreme Loser
January 1999
|
You need to link against liballegro-5.0.0-RC2-md.a as well. |
|
Aaron Whipple
Member #4,001
November 2003
|
After adding that I ended up getting an error saying that libgcc_s_dw2-1.dll was missing from my system. I suppose its a dependency of allegro 5. Anyways, I just downloaded the dll from a 3rd party site and copied it to my mingw folder. Allegro 5 seems to be working now. Thanks again for all the help. By the way, how do you link code on the forums? I thought the old tag was [code][/code] but i guess thats wrong |
|
SpectreNectar
Member #10,969
May 2009
|
Good for you that you have it working ^^ Just wanted to share the formatting help button that you see just above the text field. It's right next to preview. Code is done like this: < code start="1">int x = 1;< /code> int x = 1; (Without spaces at the beginning) |
|
Thomas Fjellstrom
Member #476
June 2000
|
Aaron Whipple said: I suppose its a dependency of allegro 5. Nope. Its a dependency of GCC itself. You can skip that by adding -static-libgcc to your linking options. -- |
|
Aaron Whipple
Member #4,001
November 2003
|
ah, Thank you. I was trying to locate that button |
|
Trent Gamblin
Member #261
April 2000
|
Offtopic, but this is the first I've seen this site having A5 binaries. I'm going to lay allegro5.org to rest now. I'll make a backup for what it's worth and alias it to http://alleg.sf.net.
|
|
LennyLen
Member #5,313
December 2004
|
SpectreNectar said: Just wanted to share the formatting help button that you see just above the text field. It's right next to preview. Code is done like this: < code start="1">int x = 1;< /code> You can escape the XHTML tags with a '\' if you want to show someone what tags are required without them being parsed. e.g. \<code start="1">int x = 1;</code> will display <code start="1">int x = 1;</code>
|
|
|