I'm trying to learn GLFW and i found a good tutorial online. I did everything they did but when i even try to write a line of code to main() a lot of errors occur.
The first two error given are
In file included from main.cpp:10:0:
/usr/include/GL/glew.h:15769:109: error: conflicting declaration ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, const GLint*)’
typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);
^
In file included from /usr/include/GL/gl.h:2055:0,
from /usr/include/GLFW/glfw3.h:153,
from main.cpp:7:
/usr/include/GL/glext.h:11616:25: note: previous declaration as ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, GLint*)’
typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
^
Followed by many errors that look like
In file included from main.cpp:10:0:
/usr/include/GL/glew.h:16432:17: error: ‘PFNGLCLIENTACTIVETEXTUREPROC’ does not name a type
GLEW_FUN_EXPORT PFNGLCLIENTACTIVETEXTUREPROC __glewClientActiveTexture;
^
Since there were to many error i will paste them in pastebin: here
My code is:
#include <iostream>
#include <GLFW/glfw.h>
#include <GL/glew.h>
int main()
{
return 0;
}
I compile it using this command:
g++ -o exec main.cpp -I/usr/include/libdrm -lglfw -I/usr/include/libdrm -lGL -I/usr/include/libdrm -lGLEW -lGLU
I have everything installed and i can create GLFW programs without glew but glew seems to be causing those problems.
Thank you!
EDIT: I use Ubuntu if it matters.
from http://glew.sourceforge.net/install.html
Also, GLEW will warn you by issuing a preprocessor error in case you have included gl.h, glext.h, or glATI.h before glew.h.
I suspect that #include <GLFW/glfw.h>
internally does one of these things. Try swapping the includes.
GLFW confirms: http://www.glfw.org/docs/3.0/build.html
If you are using an OpenGL extension loading library such as GLEW, the GLEW header should also be included before* the GLFW one. The GLEW header defines macros that disable any OpenGL header that the GLFW header includes and GLEW will work as expected.