-1

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...

genpfault
  • 51,148
  • 11
  • 85
  • 139
y0u4r3w3
  • 67
  • 3
  • 6
  • can you give us the permalink to this configuration? The `glad.c` I have has only 1834 lines and not 2441 – kaios Dec 18 '20 at 15:04
  • Of course, @genpfault, [here](http://glad.dav1d.de/#profile=core&specification=gl&api=gl%3D4.6&api=gles1%3Dnone&api=gles2%3Dnone&api=glsc2%3Dnone&language=c&loader=on) it is – y0u4r3w3 Dec 18 '20 at 21:14
  • You wanted to @kaios, I only edited the question :) – genpfault Dec 19 '20 at 01:09
  • Oopsie.. my bad – y0u4r3w3 Dec 19 '20 at 03:41
  • How many lines does your `glad.c` file contains? In the file generated by your link, there are no ext versions of the variables`glad_glRenderbufferStorageMultisampleEXT`. Maybe try to redownload it, and compile it again? – kaios Dec 19 '20 at 09:18
  • 1
    @kaios, maaan.... i don't know what kinda magic is that, but it actually works) – y0u4r3w3 Dec 19 '20 at 20:22

1 Answers1

0

Just make sure to download the correct configuration of GLAD, it's going to be okay.

y0u4r3w3
  • 67
  • 3
  • 6