Question

error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)
error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)
error LNK2019: unresolved external symbol __imp__glDrawElements@16 referenced in function "void __cdecl render(void)" (?render@@YAXXZ)

Trying to compile the "modern opengl" example for SDL2 at http://lazyfoo.net/tutorials/SDL/. My VS2012 project platform is set to win32 and I pointed the lib directories to the 32bit directories of SDL2.1.15 and Glew1.10. But something is amiss?

#include <SDL.h>
#include <gl\glew.h>
#include <SDL_opengl.h>
#include <gl\glu.h>
#include <stdio.h>
#include <string>
#include <fstream>

linking: glew32.lib glew32mx.lib SDL2.lib SDL2main.lib

Was it helpful?

Solution

This has absolutely nothing to do with GLEW. Those unresolved external symbols come from opengl32.lib, which you unfortunately forgot to include in your linking libs.

What is more, you should not be using glew32 and glew32mx; you cannot write software that is both single-context and multi-context. It is either one or the other.

Chances are pretty good you are doing single-context management, you would know and understand why you need glew32mx if you had a legitimate use-case for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top