Jump to content

  • Log In with Google      Sign In   
  • Create Account


Linking Allegro troubles


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 29 June 2012 - 12:38 AM

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!!!

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


Sponsor:

#2 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 29 June 2012 - 06:53 PM

Anybody

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#3 Aldacron   GDNet+   -  Reputation: 3043

Like
0Likes
Like

Posted 29 June 2012 - 07:42 PM

When you have linker problems like this, you need to post the command line you are using. Source snippets don't help in this case. Otherwise, we can only just guess.

#4 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 29 June 2012 - 10:19 PM

The problem is that i dont know what to link. i put the code in because i thought it might help show what i need to link.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#5 theo2005   Members   -  Reputation: 114

Like
0Likes
Like

Posted 30 June 2012 - 02:52 AM

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:

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.


So that's quite easy.

Then again..


You shouldn't use Dev-C++. It's very old, extremely buggy, and will hinder the process of learning to program.


Edited by theo2005, 30 June 2012 - 03:02 AM.


#6 Aldacron   GDNet+   -  Reputation: 3043

Like
0Likes
Like

Posted 30 June 2012 - 04:28 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS