Results 1 to 6 of 6

Thread: compile error glxext.h

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    9

    compile error glxext.h

    Hi, all!!!
    I'm add my project new header files gl3.h, glext.h, glxext.h
    Compile project, I get error:
    Code :
     
    glxext.h: 407: error: 'XID' is not a type name
    glxext.h: 411: error: 'XID' is not a type name
    glxext.h: 416: error: 'XID' is not a type name
    glxext.h: 420: error: 'Bool' is not a type name
    glxext.h: 421: error: ISO C + + forbids declaration 'Display' with no type
    glxext.h: 421: error: expected ';' before '*' token
    glxext.h: 422: error: 'GLXDrawable' is not a type name
    glxext.h: 500: error: expected initializer before '*' token
    glxext.h: 501: error: expected initializer before '*' token
    glxext.h: 502: error: typedef-declaration 'PFNGLXGETFBCONFIGATTRIBPROC' with initialization (use the design __typeof__)
    glxext.h: 502: error: no declaration 'Display' in this scope
    glxext.h: 502: error: no declaration 'dpy' in this scope
    glxext.h: 502: error: no declaration 'GLXFBConfig' in this scope
    glxext.h: 502: error: expected primary-expression before 'int'
    glxext.h: 502: error: expected primary-expression before 'int'
    glxext.h: 503: error: expected initializer before '*' token
    Please, help me!!!
    What am I doing wrong, why there are errors?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    408

    Re: compile error glxext.h

    I am not exactly sure but reading the gl3.h file itself makes a statement that directly quotes "It is not possible to #include both <GL3/gl3.h> and either of <GL/gl.h> or <GL/glext.h> in the same source file." So make sure you don't have gl.h or glext.h include directives. Note glxext.h is linux specific so don't use it if you are in windows.

    For years I have been frustrated by using the gl*ext header files directly so that is why I resort to the excellent cross-platform helper library GLEW: The openGL Extensions Wrangler. Another alternative that some like for the same purpose is GLee

    For me I use glew to get the extensions so for what it is worth what I do is

    Code :
    #include <GL/glew.h>     // great opengl extensions helper
    #include <GL3/gl3.h>
    #include <GL/freeglut.h> // use of opengl 3.0 context requires freeglut!
     
    // compile with g++ main.cpp -lglut -lGLEW -DGL3_PROTOTYPES

    Also I have found that I have to have a "#define GL3_PROTOTYPES" set before the gl3 header is included - in g++ this is just a -DGL3_PROTOTYPES command line option. In other compilers I bet just putting #define GL3_PROTOTYPES line before your #include's will accomplish the same thing.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    9

    Re: compile error glxext.h

    Thanks!

    I'm doing a project as a replacement for GLEW. And I need to initialize GL, GLX, WGL extension, using only glext, glxext, wglext. I think it's really done. using only these headers.

    Or I have missed something ... then add some please.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    408

    Re: compile error glxext.h

    I looked at glew.h and followed its includes and noticed in Linux at least it explicitly added the following headers

    Code :
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    #include <X11/Xmd.h>

    That reduced the number of compile errors but I was still left some .. maybe that will help in part. So it appears glxext.h has some dependencies on X11/headers that you have to include explicitly.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    408

    Re: compile error glxext.h

    After reading some more especially the glx.h header, it appeared as simple as just including gl3.h and glx.h. However on closer inspection glx.h includes gl.h and glxext.h -- gl.h doesn't make sense if you want to use the new gl3.h! So I decided to pull the minimal parts from glx.h that were needed to get rid of the compiler errors and came up with the following:

    Code :
    #include <X11/Xlib.h>
    #include <X11/Xutil.h>
    #include <GL/gl3.h>
     
    typedef XID GLXContextID;
    typedef XID GLXPixmap;
    typedef XID GLXDrawable;
    typedef XID GLXPbuffer;
    typedef XID GLXWindow;
    typedef XID GLXFBConfigID;
    typedef struct __GLXcontextRec *GLXContext;
    typedef struct __GLXFBConfigRec *GLXFBConfig;
     
    #include <GL/glxext.h>

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    9

    Re: compile error glxext.h

    to marshats:
    Thanks!!!
    Your post helped, these errors are not already, thanks for the help.

Similar Threads

  1. Shader Compile Error: ERROR: 0:1: '' : syntax error #version
    By Blakeasd in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 07-25-2013, 07:35 PM
  2. Help I got error when it compile
    By zenki in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-16-2009, 06:55 AM
  3. error when i try to compile it ...?
    By squall in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 09-20-2004, 11:26 AM
  4. VC++ 7 compile error
    By harikishan7 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 06-01-2004, 08:24 AM
  5. Yet Another Compile Error
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-08-2001, 12:06 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