a problem with opengl and glfw

Started by
6 comments, last by Gooey 9 years, 5 months ago

i am a new on opengl and following a tutorials but at this poient get stuck and this error show i don't know what can i do to solve it

this

E:\**********CppProjects\glew-1.11.0-win32_3\glew-1.11.0\lib\Release\Win32\glew32s.lib(tmp\glew_static\Release\Win32\glew.obj):(.text$mn+0x7)||undefined reference to `_imp__wglGetProcAddress@4'|

please i need to know that cause this problem

Advertisement

Undefined reference error means that the linker can't find the definition of a function. Seems like you are missing opengl32.lib from the linker settings.

Derp

thanks for reply iam using this on linker>>other options

-lglew32 -lopengl32 -glfw32 -lglu32

Have you tried changing the order of the libraries? Try putting -lopengl32 first.

Derp

i have tried that but its still show the error

||=== Clean: Debug in cgame (compiler: GNU GCC Compiler) ===|
||=== Build: Debug in cgame (compiler: GNU GCC Compiler) ===|
E:\CppProjects\cgame\GameWindow.h||In constructor 'GameWindow::GameWindow(bool)':|
E:\CppProjects\cgame\GameWindow.h|17|warning: 'GameWindow::_window' will be initialized after [-Wreorder]|
E:\CppProjects\cgame\GameWindow.h|14|warning: 'RenderEngine* GameWindow::_render' [-Wreorder]|
E:\CppProjects\cgame\GameWindow.cpp|14|warning: when initialized here [-Wreorder]|
E:\CppProjects\cgame\RenderEngine.cpp|39|warning: 'renderEngine' is used uninitialized in this function [-Wuninitialized]|
||Warning: .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized|
E:\CppProjects\glew-1.11.0-win32_3\glew-1.11.0\lib\Release\Win32\glew32s.lib(tmp\glew_static\Release\Win32\glew.obj):(.text$mn+0x7)||undefined reference to `_imp__wglGetProcAddress@4'|
E:\CppProjects\glew-1.11.0-win32_3\glew-1.11.0\lib\Release\Win32\glew32s.lib(tmp\glew_static\Release\Win32\glew.obj):(.text$mn+0x4)||undefined reference to `_imp__wglGetProcAddress@4'|
||=== Build failed: 2 error(s), 5 warning(s) (0 minute(s), 4 second(s)) ===|

i am using

this includes :

#define GLFW_INCLUDE_GLU
#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/glfw3.h>
#include "VertexBuffer.h"
#include "ShaderInterface.h"
#include <vector>
#include <iostream>

Put -lopengl32 last, not first, because the linker does not know other libraries depend on it before having worked on these.

Also it would be better to not use glu, its outdated and there are better ways of setting the projection and getting mipmaps made.

And you should order the constructor initializer list in the same way as the class members, fix the bug with the access to the uninitialized variable and fix the setting thats not recognized.

Put -lopengl32 last, not first, because the linker does not know other libraries depend on it before having worked on these.

Also it would be better to not use glu, its outdated and there are better ways of setting the projection and getting mipmaps made.

And you should order the constructor initializer list in the same way as the class members, fix the bug with the access to the uninitialized variable and fix the setting thats not recognized.

thanks ill try that

Of course you have #include <GL/glew.h> before anything else right?
If so and it still doesnt work try putting #define GLEW_STATIC before that

This topic is closed to new replies.

Advertisement