I am having troubles running glew.
Using the following code:
#include <GL/glew.h>
#include <GL/freeglut.h>
#include <iostream>
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitContextVersion(3, 1);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
glutInitWindowSize(1024, 768);
//glutInitWindowPosition(100, 100);
glutCreateWindow("First run.");
// init glew
GLenum glewInitResult;
glewExperimental = GL_TRUE;
glewInit();
/*
if(GLEW_OK != glewInitResult)
{
std::cerr << "ERROR: " << glewGetErrorString(glewInitResult);
return 1;
}
*/
std::cout << "hello";
glClearColor(0,0,0,0);
glutMainLoop();
return 0;
}
I then compile/link with the following in MinGW:
g++ -c -o glewTest.o glewTest.cpp -I"C:\MinGW\include\GL" -DGLEW_STATIC
and...
g++ -o glewTest.exe glewTest.o -L"C:\MinGW\lib" -lglew32 -lfreeglut -lopengl32 -lglu32 -Wl,--subsystem,windows
or...
g++ -o glewTest.exe glewTest.o -L"C:\MinGW\lib" -lglew32mx -lfreeglut -lopengl32 -lglu32 -Wl,--subsystem,windows
The "g++ -o glewTest.exe glewTest.o -L"C:\MinGW\lib" -lglew32 -lfreeglut -lopengl32 -lglu32 -Wl,--subsystem,windows"
does compile, but when I try to run I get the following error:
"The procedure entry point glewInit@0 could not be located in the dynamic link library glew32.dll"
When I try to compile with "g++ -o glewTest.exe glewTest.o -L"C:\MinGW\lib" -lglew32mx -lfreeglut -lopengl32 -lglu32
-Wl,--subsystem,windows", I get the follow error:
"glewTest.o:glewTest.cpp:(.text+0x15a): undefined reference to `glewInit@0' collect2.exe: error: ld returned 1 exit status"
I am at a loss...what do I do to either get the sys to find the dll, or get it to find the lib ref?
I am fine with either a static or dynamic lib build, but I have already tried the following with the dll version:
-
Place the DLL in the same folder with the executable. No joy.
-
Make sure I am using the same version and mem type (32/64bit) of the Lib with the DLL. Did so. Had no bearing.
-
Make sure I am placing the lib/DLL/Headers in the correct paths. Did so. Also had no bearing.
-
Make sure I am linking my necessary files correctly in the compile process. Obviously not working.
I have tried sifting through over 40-50 different webpages and they all pretty much say the same thing. Any new ideas?