Sign in to follow this  
Crusable77

Linking Allegro troubles

Recommended Posts

Crusable77    594
Hello, can somebody please help me or link me to a tutorial for my problem. i have looked online foe about an hour and couldn't finda anything. I am trying to link allegro on ubuntu 12.04 (its 32-bit not sure if that matters (probably doesn't)) on the Code::Blocks IDE. when i put a sample project from the internet in :


#include </usr/include/allegro.h> //the /usr/include/allegro.h is where allegro is on my hardrive.

int main()
{
//Initialize Allegro
allegro_init();

//Set the resolution to 640 x 480 with SAFE autodetection.
set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);

//Install the keyboard handler
install_keyboard();

//Print your welcome message to the screen
textout(screen, font, "Hello Dream.In.Code! This is my first Allegro Program", 1, 1, 10);
textout(screen, font, "Press ESCape to quit.", 1, 12, 11);

//Loop until escape is pressed
while(! key[KEY_ESC])
poll_keyboard();

//Exit program
allegro_exit();
return 0;
}

END_OF_MAIN();


i get these errors:


/usr/include/allegro/alcompat.h|157|error: undefined reference to '_textmode'|
/usr/include/allegro/alcompat.h|157|error: undefined reference to 'textout_ex'|
/home/matt/C++Crap/Allegro /main.cpp|6|error: undefined reference to '_install_allegro_version_check'|
/home/matt/C++Crap/Allegro /main.cpp|9|error: undefined reference to 'set_gfx_mode'|
/home/matt/C++Crap/Allegro /main.cpp|12|error: undefined reference to 'install_keyboard'|
/home/matt/C++Crap/Allegro /main.cpp|15|error: undefined reference to 'font'|
/home/matt/C++Crap/Allegro /main.cpp|15|error: undefined reference to 'screen'|
/home/matt/C++Crap/Allegro /main.cpp|16|error: undefined reference to 'font'|
/home/matt/C++Crap/Allegro /main.cpp|16|error: undefined reference to 'screen'|
/home/matt/C++Crap/Allegro /main.cpp|20|error: undefined reference to 'poll_keyboard'|
/home/matt/C++Crap/Allegro /main.cpp|19|error: undefined reference to 'key'|
/home/matt/C++Crap/Allegro /main.cpp|23|error: undefined reference to 'allegro_exit'|
||=== Build finished: 12 errors, 0 warnings ===|


please help me!!!

Share this post


Link to post
Share on other sites
theo2005    114
I remember having problems with Code::blocks as well with allegro, but that just may be my memory.
When I worked with allegro, I used Dev-C++. There's another post here in the forum, I'll just quote what another member said:

[quote][size=1]in Dev-C++ go to the Tools menu and click Check for updates/Packages. Select a devpak server from the drop down menu and click Check for updates. You'll see a list of packages that you can download, find Allegro and check it and download it.[/size][/quote]

So that's quite easy.

Then again..


[quote][url="http://www.jasonbadams.net/20081218/why-you-shouldnt-use-dev-c/"]You shouldn't use Dev-C++[/url]. It's very old, extremely buggy, and will hinder the process of learning to program.[/quote] Edited by theo2005

Share this post


Link to post
Share on other sites
Aldacron    4544
All of those missing symbols are from allegro, so you need to link with whichever version of the library you have. Assuming you are using GCC to compile, then the library should be named something like liballegro.a or some such.

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