The exception is:

Unhandled exception at 0x6474f269 in Loliboll.exe: 0xC0000005: Access violation reading location 0x0000000c.

I think it's a memory leak.

I tried to solve it obviously, but to no prevail.

This is the code:

#include "stdafx.h"

using namespace std;


int main()
{
//	FreeConsole();

	int a;

//	INTRO = 1;
//	MENU = 2;
//	INGAME = 3;

	elf_handle gui = elfCreateTextureFromFile("startup.png");
	elfSetGui(gui);
    elfInitWithConfig("config.txt");

  elf_handle scn = elfLoadScene("level1.pak");
	elf_handle cam = elfGetCameraByName(scn, "Camera");

	elf_handle tex = elfCreateTextureFromFile("startup.jpg");
	elf_handle pic = elfCreatePicture("MyPicture");
	elfHideMouse(true);

	
	//Sets the default state to be the intro state.

	a = 1;

	elf_handle timer = elfCreateTimer();
	elfStartTimer(timer);
	elfSetPictureTexture(pic, tex);
	elfAddGuiObject(gui, pic);

    while(elfRun())
    {a
		
		if (a == 1)
		{
			if(elfGetElapsedTime(timer) > 5.0)
				elfSetGuiObjectVisible(pic, false);
				a = 2;
		}
		
		if (a == 2)
		{
		}

		if (a == 3)
		{
		}
		
    }

    elfDeinit();

    return 0;

}

By the way, there are no errors or warnings, i solved those.

elf_handle is probably defined wrong.

It would be good practice to always check your return codes. If you do so, you will most likely find your error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.