glGenVertexArrays access violation

Hello! I am building a simple glfw and opengl program and I got this error:

Exception thrown at 0x00000000 in ConvexHullVisualiser.exe: 0xC0000005: Access violation executing location 0x00000000.

This is part if my main>



	glewExperimental = GL_TRUE;
	int err = glewInit();
	if (!err) {
		exit(-1);
	}

	GLuint VertexArrayID;
	glGenVertexArrays(1, &VertexArrayID);
	glBindVertexArray(VertexArrayID);

	static const GLfloat g_vertex_buffer_data[] = {
		100.0f, 100.0f, 0.0f,
		150.0f, 100.0f, 0.0f,
		100.0f, 150.0f, 0.0f,
	};

	GLuint vertexbuffer;

	glGenBuffers(1, &vertexbuffer);
	glGenBuffers(1, &vertexbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

	GLFWwindow* window;
	window = initWindow(640, 480, "Title");
	while (!glfwWindowShouldClose(window)) {

		glViewport(0, 0, 640, 480);
		glClearColor(0, 0, 0,0);
		glClear(GL_COLOR_BUFFER_BIT);

		glEnableVertexAttribArray(0);
		glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
		glVertexAttribPointer(0,3,GL_FLOAT, GL_FALSE, 0, (void*)0);

		glDrawArrays(GL_TRIANGLES, 0, 3);
		glDisableVertexAttribArray(0);

		glFlush();

		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	glfwTerminate();

my initWIndow function>


GLFWwindow* initWindow(int a_width, int a_height, const char* title) {
	if (!glfwInit()) {
		printf("glfwInit() failed!");
		return nullptr;
	}
	
	GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);

	if (!window) {
		glfwTerminate();
		return nullptr;
	}

	return window;

}


I am using Visual Studio 2017 community and i doubt it is a linker error due to the fact that i got this only when using these functions.

Any Ideas? Thanks! :slight_smile:

EDIT: If it is usefull here is my full compile output


'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Users\Korisnik\Desktop\OpenGLRoot\ConvexHullVisualiser\Debug\ConvexHullVisualiser.exe'. Symbols loaded.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64
tdll.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Users\Korisnik\Desktop\OpenGLRoot\ConvexHullVisualiser\ConvexHullVisualiser\glew32.dll'. Module was built without symbols.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\fltLib.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput8.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\InputHost.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64
tmarta.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\XInput1_4.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Users\Korisnik\AppData\Local\Temp\0Kraken71ChromaDevProps.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avrt.dll'. Cannot find or open the PDB file.
Error 10 (object not found) in function enum EResult __thiscall SysAudioHook::CMMDeviceClient::EraseAudioClientInVector(struct IAudioClient *)
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atiglpxx.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atioglxx.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atioglxx.dll'
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atioglxx.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dxva2.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atigktxx.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atigktxx.dll'
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\c0332601.inf_amd64_5beeaaa0c940e99c\B332635\atigktxx.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atiadlxy.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\atiadlxy.dll'
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\atiadlxy.dll'. Cannot find or open the PDB file.
'ConvexHullVisualiser.exe' (Win32): Loaded 'C:\Windows\SysWOW64\TextInputFramework.dll'. Cannot find or open the PDB file.
Exception thrown at 0x00000000 in ConvexHullVisualiser.exe: 0xC0000005: Access violation executing location 0x00000000.

The program '[12016] ConvexHullVisualiser.exe' has exited with code 0 (0x0).

[QUOTE=64humans;1293601]Hello! I am building a simple glfw and opengl program and I got this error:

Exception thrown at 0x00000000 in ConvexHullVisualiser.exe: 0xC0000005: Access violation executing location 0x00000000.
[/QUOTE]
One of the function pointers is null.

Use e.g.


if (!GLEW_VERSION_3_0)
    exit(1);

to check that OpenGL version 3.x is supported.

If the test is failing, either you’re using hardware which doesn’t support OpenGL 3.x, or the hardware drivers don’t support OpenGL 3.x, or there’s a driver installation problem which means that Windows is falling back to the built-in software-only OpenGL 1.1 implementation.