Results 1 to 5 of 5

Thread: implicit declaration warnings

  1. #1
    Member Contributor
    Join Date
    Jun 2015
    Posts
    60

    implicit declaration warnings

    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:

    Code :
    #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.

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

    what else am I missing?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,103
    Quote Originally Posted by advorak View Post
    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.
    Code :
    #include <GL/gl.h>

  3. #3
    Senior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    281
    Quote Originally Posted by advorak View Post
    ...
    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:

    Code :
    #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.

    Quote Originally Posted by advorak View Post
    when I try to use the getprocaddress function to resolve the actual function, I get an error that says the initializer is not constant.

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

  4. #4
    Member Contributor
    Join Date
    Jun 2015
    Posts
    60
    My glx.h does include gl.h as well as Xlib.h and Xutils.h.

  5. #5
    Member Contributor
    Join Date
    Jun 2015
    Posts
    60
    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.

Similar Threads

  1. Declaration
    By aje1234l in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-12-2014, 04:19 PM
  2. INVALID_ENUM warnings
    By madhav in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-16-2012, 04:27 AM
  3. Display Warnings
    By BlackBox in forum OpenGL: GLSL
    Replies: 3
    Last Post: 10-28-2004, 07:08 PM
  4. compiler warnings
    By zed in forum OpenGL: GLSL
    Replies: 3
    Last Post: 10-26-2004, 06:49 AM
  5. implicit declaration error
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-11-2001, 01:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean