LNK2001 error occurs when building but not by Debugging

  allegro5, c++, debugging, lnk2001

I have written a programm using Allegro 5 and wanted to build it in Visual Studio 19 but the build log states that there are some LNK2001 errors when I try to initialize the allegro addons I am using.

The Log:

Backend.obj : error LNK2001: unresolved external symbol __imp__al_init_image_addon
Backend.obj : error LNK2001: unresolved external symbol __imp__al_init_ttf_addon
Backend.obj : error LNK2001: unresolved external symbol __imp__al_init_font_addon
Backend.obj : error LNK2001: unresolved external symbol __imp__al_draw_filled_triangle
Backend.obj : error LNK2001: unresolved external symbol __imp__al_init_primitives_addon
E:ProjectsAllegroProgrammReleaseAllegro.exe : fatal error LNK1120: 5 unresolved externals

These are my includes:

#include "allegro5/allegro.h"
#include "allegro5/allegro_image.h"
#include "allegro5/keyboard.h"
#include "allegro5/keycodes.h"
#include "allegro5/allegro_native_dialog.h"
#include "allegro5/allegro_ttf.h"
#include "allegro5/allegro_font.h"
#include "allegro5/allegro_primitives.h"

And thats how I call the al_init_… functions:

al_init();
al_install_mouse();
al_install_keyboard();
al_init_image_addon();
al_init_font_addon();
al_init_ttf_addon();
al_init_primitives_addon();

And as I said in debug mode it works but not in release I have no clue why!

Thanks

Source: Windows Questions C++

LEAVE A COMMENT