James C
James C

Reputation: 919

Build successful, but I get GLEW error when trying to run a program

I am trying to compile and run a C++ & OpenGL ( with GLEW ) program in CodeBlocks 13.12 .

The code built successfully, but when I want to run it, it gives me the error ( Entry Point Not Found ) saying :

The procedure entry point glewInit@0 could not be located in the dynamic link library glew32.dll .

glew32.dll is located in System32 folder ( I am using Win7 x64 ).

EDIT :

The current errors I get are:

||=== Build: Debug in tutorial2cpp (compiler: GNU GCC Compiler) ===|
obj\Debug\glew.o||In function `glewInit_GL_VERSION_1_2':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3233|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3234|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3235|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3236|undefined reference to `wglGetProcAddress@4'|
obj\Debug\glew.o||In function `glewInit_GL_VERSION_1_3':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3253|undefined reference to `wglGetProcAddress@4'|
obj\Debug\glew.o:N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|3254|more undefined references to `wglGetProcAddress@4' follow|
obj\Debug\glew.o||In function `glewGetExtension@4':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|9475|undefined reference to `glGetString@4'|
obj\Debug\glew.o||In function `glewContextInit':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|9495|undefined reference to `glGetString@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|9535|undefined reference to `glGetString@4'|
obj\Debug\glew.o||In function `glewInit_WGL_3DL_stereo_control':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11540|undefined reference to `wglGetProcAddress@4'|
obj\Debug\glew.o||In function `glewInit_WGL_AMD_gpu_association':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11553|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11554|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11555|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11556|undefined reference to `wglGetProcAddress@4'|
obj\Debug\glew.o:N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|11557|more undefined references to `wglGetProcAddress@4' follow|
obj\Debug\glew.o||In function `wglewGetExtension@4':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|12111|undefined reference to `wglGetCurrentDC@0'|
obj\Debug\glew.o||In function `wglewContextInit@0':|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|12124|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|12125|undefined reference to `wglGetProcAddress@4'|
N:\projekticpp\OpenGL\samhocevartutorial\tutorial2cpp\glew.c|12133|undefined reference to `wglGetCurrentDC@0'|
||=== Build failed: 19 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

Selected compiler is GNU GCC Compiler, I didn't change any compiler settings.

I wanted to check this tutorial , which apparently just adds stuff to part #1 . So I have copied the part #1 code into project but I get all those errors. Obviously, I am missing some fundamental knowledge, because most people who tried to get this running didn't seem to have any major issues. Due to that I am pretty much stuck, but would like to learn how to solve this kind of problems so I can avoid them in future.

Upvotes: 1

Views: 1997

Answers (1)

datenwolf
datenwolf

Reputation: 162319

Essentially this error message tells you, that the symbol definitions you linked (the .lib) doesn't match the DLL that got located by your system.

Your best course of action is to link GLEW statically with your program, which avoids DLL problems alltogether. See the section "Including the source files / project file" on http://glew.sourceforge.net/install.html for how to do it.

glew32.dll is located in System32 folder

Never write anything that's not part of the Windows distribution into System32 or any other directory beneath \Windows – things will break.

Upvotes: 1

Related Questions