Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [Linker error] undefined reference to `_imp__screen'

This thread is locked; no one can reply to it. rss feed Print
[Linker error] undefined reference to `_imp__screen'
Nick Cash
Member #6,082
August 2005

Alright, I have a very simple program setup, as I am just working my way into real work with Allegro, but every time I try to draw basic primitives I get this:

[Linker error] undefined reference to `_imp__screen'

This results from:

1void init_prog( void )
2{
3 allegro_init();
4 install_timer();
5 install_keyboard();
6 install_mouse();
7}
8 
9int main( void )
10{
11 init_prog(); /* initialize everything */
12 
13 set_color_depth(16);
14 set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0 );
15
16 putpixel( screen, 250, 200, 5 ); /* the problem is here */
17 
18 readkey();
19 
20 return 0;
21}
22END_OF_MAIN()

I originally had clear_to_color() instead of putpixel(), and I go the same error.

And help would be appreciated. Once I can get over this slump I think things will progress quickly. Its hard to play around a lot when you dont have any graphics!

~Odis

HoHo
Member #4,534
April 2004
avatar

How do you link your programs? What parameters you give to the linker?

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

ReyBrujo
Moderator
January 2001
avatar

Remember to include Allegro. And link using -lalleg under MinGW or DJGPP, `allegro-config --libs` under Linux. If after that you are still getting those errors, tell us your Allegro version, compiler [version] and system. The examples work? If not, it is probably you need to compile the library again.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Nick Cash
Member #6,082
August 2005

I compiled it as a static library. I'm working with Dev-C++, and my linking options are as follows:

-lalleg_s
-luser32
-lgdi32
-lcomdlg32
-ldinput
-lddraw
-ldxguid
-lwinmm
-ldsound
-lkernel32
-lole32

I was thinking I probably needed to recompile the library. Also, allegro.h is included (sorry, forgot to include that within the snippets I posted). The DX I'm using is DX8 found off the Allegro download section.

I'm working off the most recent stable version of allegro, 4.08 I THINK it was. If it wasn't obvious, I'm working of Windows (XP).

I ran several of the examples (3D boxes, camera, etc) and they seemed to work correctly.

~Odis

ReyBrujo
Moderator
January 2001
avatar

If you want to link with the static version of Allegro, you need to define ALLEGRO_STATICLINK before including the header.

Latest stable is 4.0.3, latest WIP is 4.2.0 beta 4.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Nick Cash
Member #6,082
August 2005

Wow, thats an easy fix. Thanks!

Sorry about the version, thats what I get for not checking. It is 4.0.3.

~Odis

Go to: