1 year ago

#258417

test-img

Boris Vassilev

Clang++ cannot find GL/glu.h, but g++ (mingw-w64) works correctly

I am making a OpenGL wrapper in C++ and modern OpenGL. So in my main header I have the following includes

#define GLFW_INCLUDE_GLU
#ifdef _WIN32
    #define GLFW_DLL
#endif

#include <GL/glew.h>
#include <GLFW/glfw3.h>

And compile with this command through a makefile: g++ <all sources> -g -o main.exe -L"D:/cpp_libraries/glfw-3.3.5-compiled/src" -L"D:/cpp_libraries/glew-2.1.0-compiled/lib" -lglfw3 -lglew32 -lopengl32 -I"./include" -I"D:/cpp_libraries/glfw-3.3.5-source/include" -I"D:/cpp_libraries/glew-2.1.0-source/include" -I"D:\cpp_libraries\glm" -std=c++2a -Wall

This works correctly. Then I tried switching g++ to clang++ for compilation and now there is an error on line 1205 in glew.h: glew.h:1205:14: fatal error: 'GL/glu.h' file not found

After a google search I found out I really shouldn't need glu. I tried adding a #define GLEW_NO_GLU before the inclusion of glew, all that does is make glfw3.h throw the same error. I also tried removing the #define GLFW_INCLUDE_GLU and that somehow made clang fail to find libraries like iostream and chrono. Neither of these changes had any effect on the compilation with gcc.

This is my first time using clang and I really hope that I have not done some elementary mistake in assuming it is too similar to gcc

c++

opengl

clang++

glew

glu

0 Answers

Your Answer

Accepted video resources