Allegro5 won’t load image though everything is there?

  allegro5, c++, loading

I had to work with allegro5 for a school project and are now trying to make a third party object oriented support for easier use in projects of my own. Now I am trying to render everything with one Update() call. I have a function that takes in an array of elements which can be everything from button to image and differenciate them by flags. Everything work perfectly so far the thing is that when calling the constructor it doesn’t load the image into the data path and breaks the render cycle.

My class(simplified but with everything necessary):

class Element
const char* input;

int flag;
int dx;
int dy;


Element() {}
Element(int flag, int dx, int dy, const char* input)
    this->flag = flag;
    this->dx = dx;
    this->dy = dy;
    this->input = input;

    if (this->flag == KS_AL_ADDON_PIC)
        picture = al_load_bitmap(this->input);
        if (picture == NULL)
            cout << "Failed to load image!n";

When running I get the violation error at the al_draw_bitmap() function as expected and it prints out "Failed to load image!" but I can’t figure why it won’t load.

Doing it manualy the with the path not changed it works.

Source: Windows Questions C++