Sign in to follow this  
yurian

Linking libraries ripping my hair out!

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);
    readkey();

    return 0;
}
END_OF_MAIN();






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

Share this post


Link to post
Share on other sites
Quote:
Original post by yurian
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 :)
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 this post


Link to post
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this