Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Error with primitives

This thread is locked; no one can reply to it. rss feed Print
Error with primitives
SaSSolino
Member #16,806
February 2018

Hi everyone, I'm new to Allegro and had some issues with primitives:

I tried to use al_init_primitives_addon and al_draw_line, but they both give me errors:

__imp__al_init_primitives_addon unresolved in _main function

__imp__al_draw_line unresolved in _main function

2 unresolved external links

I have #include <allegro5\allegro_primitives.h> in my code. Why is this happening? Thanks!

Eric Johnson
Member #14,841
January 2013
avatar

Did you call al_init_primitives_addon() and link the proper libraries?

SaSSolino
Member #16,806
February 2018

I did call al_init_primitives_addon(), and I think I linked the proper libraries. To be safe, which ones do I need?

Edgar Reynaldo
Member #8,592
May 2007
avatar

It says undefined reference to _imp_ because you're linking to the wrong libraries. If you want to link statically, you need to define ALLEGRO_STATICLINK before including allegro. Link to the correct libraries and the error will go away.

To clarify and further answer the question, it depends on how allegro was built. If you have the monolith, link to that, otherwise, you need to link to every addon you use as well as the main allegro library.

SaSSolino
Member #16,806
February 2018

Thanks for the reply, but defining ALLEGRO_STATICLINK did not seem to solve the problem.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: