i'm having troubles with GLAD. I've downloaded the source files with this configuration:
- Language - C/C++
- Specification - OpenGL
- API - gl Version 4.6
- Profile - Core
- Generate loader is checked
After unpacking the archive i got this structure (made it as simple as possible for now):
project/
main.c
glad.h
glad.c
khrplatform.h
My main.c
is something like this:
#include "./glad.h"
#include <GLFW/glfw3.h>
int main() {
return 0;
}
And finally, i've tried compiling it with gcc
, because my project is going to be in c
:
gcc main.c glad.c -lglfw -lGL -ldl -I. -o run
But i got these errors:
glad.c:1328:1: error: unknown type name ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC’; did you mean ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC’?
1328 | PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT = NULL;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC
glad.c:1328:87: warning: initialization of ‘int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
1328 | PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT = NULL;
| ^~~~
glad.c: In function ‘load_GL_EXT_framebuffer_multisample’:
glad.c:2441:46: error: ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC’ undeclared (first use in this function); did you mean ‘PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC’?
2441 | glad_glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)load("glRenderbufferStorageMultisampleEXT");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC
glad.c:2441:46: note: each undeclared identifier is reported only once for each function it appears in
glad.c:2441:89: error: expected ‘;’ before ‘load’
2441 | glad_glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)load("glRenderbufferStorageMultisampleEXT");
| ^~~~
| ;
This code really seems odd for me, but it's from the library, so chaning it on my own doesn't look really good...