Search code examples
c++c++builderaccess-violationtimage

C++ access violation: TImage.Picture is null


I recently made some minor changes within my c++-builder-project-settings to distribute a built application, however now some kind of initialisation seems to be missing.

Before I was using this (worked properly):

TPngImage *img=new TPngImage;
img->LoadFromFile(pfad);
Image1->Picture->Assign(img);

However, suddenly I get the error: access-violation... access to 0x0000000. I checked and noticed that Image1->Picture is Null. Image1 is of course a TImage-Object added per designer. I'm using embarcaderos XE2 16 c++-Builder.

Is there a setting for this or could you tell me, what I have to do? I thought of Image1->Picture=new TPicture(); already, but that is also Null...


Solution

  • It seems that it was my settings...
    Somehow I messed some setting up.

    I exported the settings of a new project, copied my include-paths, overwrote the settings with the exported one and inserted the includes.

    Now everything works again.