# Linking libraries ripping my hair out!

This topic is 3358 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Oh I am sure this is so easy, but I cannot remember anything! So I have AllegroGL downloaded and unzipped on my desktop, but when I build, I am always getting errors "Undefined reference to everything." I've read annother forum and wrote in my linking options but it is not working :D I do not understand anyway. Could anyone show me the right way :) -lagl -lalleg -luser32 -lgdi32 -lopengl32 -lglu32 Using Code Blocks by the way.
#include <alleggl.h>

int main()
{
allegro_init();
install_allegro_gl();
install_keyboard();
set_gfx_mode(GFX_OPENGL_WINDOWED, 640, 480, 0, 0);

glClearColor(0.0, 0.0, 0.0, 0.0);

glClear(GL_COLOR_BUFFER_BIT);

return 0;
}
END_OF_MAIN();


Also if anyone could direct me to a good reference for linking I would so appreciate it.

##### Share on other sites
Oh thank you, except for that I don't remember how to do this... I had help a long time ago for allegro by itself :)

##### Share on other sites
Quote:
 Original post by yurianOh thank you, except for that I don't remember how to do this... I had help a long time ago for allegro by itself :)
Linking libraries is a basic skill you are going to have to learn.

First, put the libraries and headers somewhere permanent, as in, not your desktop.

Now look in codeblocks, under the options for whatever compiler you are using. There is options to add include directories (where your .h is), and options for your linker directories (where the .libs or .as are). Add the proper paths to the lists.

##### Share on other sites
Alright, I have built :)

Now compiler is telling me it cannot find -lalg. If I delete -lalg or the l, then it cannot find -lalleg. When I delete both of them I have the message undefined reference to install_allegro_gl()...

Also there is no .a file for allegrogl?