PDA

View Full Version : implicit declaration warnings



advorak
06-30-2015, 02:52 PM
I don't know what i am doing wrong here.

I believe i am including the correct header files, but i continue to get "implicit declaration of function 'gl.......'" warnings.

What do I have to do to make them go away.

Her is what I am including at the top of the file:


#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <GL/glx.h>

when I try to use the getprocaddress function to resolve the actual function, I get an error that says the initializer is not constant.


PFNGLISSHADERPROC glIsShader = (PFNGLISSHADERPROC) glXGetProcAddress( "glIsShader" );

what else am I missing?

GClements
06-30-2015, 05:11 PM
I believe i am including the correct header files, but i continue to get "implicit declaration of function 'gl.......'" warnings.

What do I have to do to make them go away.



#include <GL/gl.h>

Agent D
06-30-2015, 05:21 PM
...
I believe i am including the correct header files, but i continue to get "implicit declaration of function 'gl.......'" warnings.
...
Her is what I am including at the top of the file:


#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <GL/glx.h>

I'm not sure if GL/glx.h is guaranteed to include GL/gl.h that contains the actual decralations, but even if, some functions
might not be declared in the gl.h header (i.e. the header is written against an older OpenGL(R) version). You might want to
include the header of an extension loader like GLEW or something similar (or your own) that declares the neccessary function
pointers and loads them.

Anyway, you get those warnings because the declarations are probably really not in the headers.



when I try to use the getprocaddress function to resolve the actual function, I get an error that says the initializer is not constant.


PFNGLISSHADERPROC glIsShader = (PFNGLISSHADERPROC) glXGetProcAddress( "glIsShader" );

what else am I missing?
Where did you write that code snippet? Inside a function or at global scope? I guess you are trying to statically initialize a global
variable with the return value of a function. In order to get the value, the function has to be called at run time. It is not possible
to determine the value at compile time, i.e. the initializer is not a known, constant value.

advorak
07-01-2015, 07:21 AM
My glx.h does include gl.h as well as Xlib.h and Xutils.h.

advorak
07-01-2015, 07:22 AM
I may be screwed up with where I am putting the line to get the proc address. It is at a global scope. I will move it into an init function.

Thank you for your help guys.