OpenGL bind error? Unresolved external glCreateShader ()

I am working on an OpenGL program to test shaders and try to compile them. However, calling glCreateShader () (and other shader calls such as glDeleteShader) throws the following error:

(this error is from glCreateShader ())

Error   3   error LNK2001: unresolved external symbol _pglCreateShader  

      

I am using Visual Studio 2012 and Windows 7. Got one of the latest nvidia cards including the latest drivers so cannot be my OpenGL version.

I am using glTools header files for all the helper functions for OpenGL Superbible 4th edition. Not sure if there is a bug when using these files?

I'll post my suggestions in case it helps too.

#pragma once

#include <Windows.h>

// Basic C++ includes
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <vector>
using namespace std;

// OpenGL specific and GUI includes
#include "shared/gltools.h"
#include "shared/math3d.h"
#include <SOIL.h>

      

And the linker options:

soil.lib;opengl32.lib;gltools.lib;

      


Oké, the problem was solved thanks to the answers:

I edited my glTools.h to include "gl / glew.h" instead of "glee.h", added the: glew32.lib parameter to my linker, and added glewInit () before entering the main loop. I also added the GLEW libraries, DLLs and included them in the appropriate folder and all the functions work as they should! :)

+3


source to share


2 answers


Grab a copy of GLEW to handle the extension download.



Doing it manually ... annoying.

+3


source


On Windows, you are using WGL, and when using WGL, you cannot directly link to GL functions. All the features you get are these ; you must dynamically grab the pointer to the GL entry point you want with wglGetProcAddress

(as in here ) before you can use them.



Basically, OpenGL on Windows is PITA if you manually load the GL entry point function pointer. It is much easier to use a utility library to grab pointers for you, such as GLEW .

+2


source







All Articles