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!
Did you call al_init_primitives_addon() and link the proper libraries?
I did call al_init_primitives_addon(), and I think I linked the proper libraries. To be safe, which ones do I need?
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.
Thanks for the reply, but defining ALLEGRO_STATICLINK did not seem to solve the problem.
I only said to do that if you're linking statically. You still need to link to the appropriate libraries.