• Advertisement
Sign in to follow this  

Problem linking gstream (Allegro library)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've downloaded the gstream DevPak (I'm using Dev-C++) to use with Allegro. In theory, everything should work fine, as I have updated gcc/c++ to the latest version. However, when I try to compile the example that went with the gstream DevPak (with the -lgstrm switch to link correctly to the gstream library), I get about 200 linker erros, describing undefined references to <whatever>function. Does anyone have the same problem, and/or might know a solution to this?

Share this post


Link to post
Share on other sites
Advertisement
Try this. I just downloaded that library for GCC 3.4 as well as Allegro.

1. Link with:

-lgmon
-lgstrm
-lalleg
Only way I knew for the -lgmon, which I have no idea what it means, was guess and check while linking. I just tried it b/c it started with a 'g' [lol]

2. Example:

#include <gstream.h> // note: you can use <gstream.h> if you prefer

int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)

{
allegro_init(); // you have to initialise Allegro and in be in a
if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) < 0) // graphical mode
return 1;

gstream gs; // construct gs, which will draw on the screen

gs << "Hello world!"; // print string with default settings

gs << flush; // gstreams are buffered so remember to flush
system("pause");
return 0;
}






This is my first time using this, so I don't know the proper way to wait for a keypress, so you will have to use the windows key to get out of the program and close it via the console window. However, you should not get linker errrors [smile] I also noticed that I could not get it to work with int main() so that is something else you will need to look into.

- Drew

Share this post


Link to post
Share on other sites
Thanks a lot for your help! It appeared the order of linking is important here: the gstream library must be linked before linking to Allegro.
I feel like a n00b, thinking the order of linking didn't matter. [grin]

Anyway, it also appeared that using the -gmon switch wasn't needed, since that library doesn't belong to the gstream DevPak; only libgstrm.a is needed.

Also, I got it to work flawlessly with int main() without any exotic actions. The only thing that seems to matter is that you use the -lgstrm prior to -lalleg.

Again, thanks for your help! Ratings++...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement