libigl
libigl copied to clipboard
Simple example failing to compile - glad/gl.h: No such file or directory
Discussed in https://github.com/libigl/libigl/discussions/2094
Originally posted by fghoussen October 10, 2022 Not used to OpenGL (learning it...).
I try to build a hello-world simple example, but, compilation fails.
Following https://learnopengl.com/Getting-started/Creating-a-window (GLAD section), I used https://glad.dav1d.de/generated/tmpcj7244tyglad/ to get a glad.zip file that I unzipped in a glad directory. Note: I expected to get a gl.h in it but there's not.
>> git clone https://github.com/libigl/libigl
>> tree glad/
glad/
├── glad.zip
├── include
│ ├── glad
│ │ └── glad.h
│ └── KHR
│ └── khrplatform.h
└── src
└── glad.c
>> cat test_viewer.cpp
#include <igl/opengl/glfw/Viewer.h>
int main() {
igl::opengl::glfw::Viewer viewer;
viewer.launch();
}
>> g++ -I libigl/include/ -I libigl/include/igl/opengl `pkg-config --cflags eigen3` -I glad/include/ -o test_viewer test_viewer.cpp glad/src/glad.c
In file included from libigl/include/igl/opengl/glfw/../bind_vertex_attrib_array.h:3,
from libigl/include/igl/opengl/glfw/../MeshGL.cpp:10,
from libigl/include/igl/opengl/glfw/../MeshGL.h:165,
from libigl/include/igl/opengl/glfw/Viewer.h:16,
from test_viewer.cpp:1:
libigl/include/igl/opengl/glfw/../gl.h:23:10: fatal error: glad/gl.h: No such file or directory
23 | #include <glad/gl.h>
| ^~~~~~~~~~~
compilation terminated.
Running debian.
>> glxinfo | grep "OpenGL version"
162:OpenGL version string: 4.2 (Compatibility Profile) Mesa 22.2.0
>> dpkg -L libgl-dev
/.
/usr
/usr/include
/usr/include/GL
/usr/include/GL/gl.h
/usr/include/GL/glcorearb.h
/usr/include/GL/glext.h
/usr/include/KHR
/usr/include/KHR/khrplatform.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/gl.pc
/usr/share
/usr/share/bug
/usr/share/bug/libgl-dev
/usr/share/bug/libgl-dev/control
/usr/share/doc
/usr/share/doc/libgl-dev
/usr/share/doc/libgl-dev/changelog.Debian.gz
/usr/share/doc/libgl-dev/copyright
/usr/lib/x86_64-linux-gnu/libGL.so
libgl-dev doesn't provide a glad/gl.h file, so, that's why I tried to generate a glad.zip from the GLAD web service: didn't help...
How to compile this simple program? Is the glad directory need?