OpenGL wrapper class problems

This is a discussion on OpenGL wrapper class problems within the Game Programming forums, part of the General Programming Boards category; ive been working on a wrapper class for OpenGL, and i got it pretty much how i want it, but ...

  1. #1
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465

    OpenGL wrapper class problems

    ive been working on a wrapper class for OpenGL, and i got it pretty much how i want it, but when i compile i get a million re-definition errors that all point back to gl.h. it looks like a multiple include, but i am only including the OGL headers in one file in my program.

    the headers for the only 3 files in my program look like this:

    Code:
    //Main.cpp
    
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include "resource.h"
    
    #include "oglDisplay.h"
    Code:
    // oglDisplay.h
    
    #ifndef _OGLDISPLAY_H_
    #define _OGLDISPLAY_H_
    
    #include "gl/gl.h"
    #include "gl/glu.h"
    
    //...
    
    #endif
    Code:
    // oglDisplay.cpp
    
    #include "oglDisplay.h"

    if you need any more code than that to deduce the problem, let me know.
    I came up with a cool phrase to put down here, but i forgot it...

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    your gl includes should be <gl/gl.h>, unless you actually have the gl includes in your project space (which would be kinda weird)

    also, there shouldn't be any redefs with the GL headers, as everything in there should already be tested for...........could you post an example of one of the redef errors?

  3. #3
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    i fixed the quotes to angle brackets (stupid mistake, i dont know what i was thinking), but that didnt fix my problem.

    my errors go something like this

    int "APIENTRY" redefinition
    50x
    int "WINGDIAPI" redefinition
    50x
    void should be preceeded by ';'
    50x
    etc...

    the 50x is arbitrary, but it says it once for every time APIENTRY and WINGDIAPI are mentioned in the header. all of these errors point to gl.h.
    I came up with a cool phrase to put down here, but i forgot it...

  4. #4
    ...
    ... is offline
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    i fixed it by moving my #include <windows.h> into the oglDisplay.h above the OpenGL includes.

    anyone know why this causes problems?
    I came up with a cool phrase to put down here, but i forgot it...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  2. class Template problems
    By Mr_roboto in forum C++ Programming
    Replies: 8
    Last Post: 02-16-2006, 09:21 PM
  3. Window Wrapper Class, WM_NCCREATE never sent
    By bennyandthejets in forum Windows Programming
    Replies: 5
    Last Post: 04-18-2004, 06:02 AM
  4. Problems with functions in a class with pointer to self
    By BigDaddyDrew in forum C++ Programming
    Replies: 6
    Last Post: 02-03-2003, 10:24 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21