Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: WINGDIAPI variable compilation error

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    5

    WINGDIAPI variable compilation error

    I'm using Borland Turbo C++ 4.5 with OpenGL, Windows98.

    I'm getting 26 compilation errors in the include file gl.h (version 37). They're all the same, "Variable WINGDIAPI is initialized more than once".

    I don't think anything is wrong with gl.h and I don't want to touch it. ...but I'm not sure what else to do.

    I'm really anxious to get started developing my own programs in OpenGL. Anybody's help would be greatly appreciated.

    Thanks

    [This message has been edited by Temo45 (edited 06-01-2002).]

    [This message has been edited by Temo45 (edited 06-02-2002).]

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: WINGDIAPI variable compilation error

    Hi !

    I am not sure why you get it, but WINGDIAPI is not a variable, it is #define for the function atrributes, like:
    void WINGDIAPI glBlaBlaBla() something.

    So it sounds like it fails to include windows.h or something like that.

    Mikael

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: WINGDIAPI variable compilation error

    Be sure to include windoze.h before you include glut.h.

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    5

    Re: WINGDIAPI variable compilation error

    Originally posted by rpxmaster:
    Be sure to include windoze.h before you include glut.h.
    Hi!

    Thanks, windows.h was included already.
    I'm wondering if it's a problem with the settings I'm using on my compiler (Turbo C++ 4.5). I would be interested in comparing my settings with those of others using the same platform. I'd greatly appreciate any advice you have.

    Jay

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,755

    Re: WINGDIAPI variable compilation error

    Is windows.h included BEFORE gl.h?

    If you're doing this..

    #include <GL/gl.h>
    #include <windows.h>

    You'll still get those errors, becase gl.h uses stuff defined in windows.h, so windows.h needs to come first.
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: WINGDIAPI variable compilation error

    On 06-01-2002 05:42 PM, a frequent contributor named rpxmaster made the following remark:
    Be sure to include windoze.h before you include glut.h.
    Like I said, be sure to include windoze.h before you include glut.h.

    So, your code should look somewhat like this:

    Code :
    /* Windoze specific header files */
     
    #include <windoze.h>
     
    /* OpenGL specific header files */
     
    #include <gl/gl.h>

  7. #7
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    5

    Re: WINGDIAPI variable compilation error

    Hi!

    >It look's pretty ok to me, is this the gl.h that was included with the Borland compiler?

    I downloaded this gl.h from the opengl.org website some time ago.
    I'm thinking it may be the wrong gl.h for Borland 4.5. I just downloaded
    BCC32 5.5 line compiler which includes a Borland gl.h. I'm going try
    it later today when I get off work.

    >the only thing that should be needed is to include windows.h before glut.h and then you >should be on your way (they say...).

    ...yep I have windows.h inlcuded before glut.h

    #include <windows.h>
    #include <GL/glut.h>
    #include <stdio.h>
    #include <stdlib.h>
    ...
    ...

    >Do you think you could send me your windows.h (or wingdi.h if you have that one, it is >included from windows.h), the problem might be in there somewhere.

    Sure, they're both attached to this file.We may be on the right track here. I tried changing the compiler from one that accepts Borland Extensions to the ANSI standard. Now the errors are different, they're in windows.h

    The compiler only reports the first 26 errors I guess but I didn't see anymore errors in gl.h (they might still be there, shifted to the bottom). The new errors are:

    windows.h 209: , expected
    windows.h 210: , expected
    windows.h 213: , expected
    windows.h 214: Multiple declartion for'_far'
    windows.h 214: , expected
    windows.h 216: Multiple declartion for'_near'
    windows.h 216: , expected

    Thanks again Mikael,

    Jay

  8. #8
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: WINGDIAPI variable compilation error

    You definately want to check out this page:
    http://home.clara.net/paulyg/ogl.htm#Borland

    From here, you can download the latest version of gl.h for Borland, as well as glut32.h, glut32.lib, and glut32.dll, also for Borland.

    Also, make sure you include your ANSI headers before you include windoze.h. It does make a difference which order you put your include statements. Therefore, your code should look like:

    Code :
    /* ANSI C-Specific header files */
     
    #include <stdio.h>
    #include <stdlib.h>
     
    /* Windoze specific header files */
     
    #include <windoze.h>
     
    /* OpenGL specific header files */
     
    #include <gl/glut.h>
    This'll really help.

  9. #9
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Omaha, NE US
    Posts
    119

    Re: WINGDIAPI variable compilation error

    ...uh, yeah...what about it?

  10. #10
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    5

    Re: WINGDIAPI variable compilation error

    I decided to upgrade. I'm using the Borland C++ 5.5 command line compiler now. I followed the directions at http://home.clara.net/paulyg/ogl.htm#Borland
    and the compiler appears to be finding everything it needs. None of the previous
    errors are showing. However there are two that I'm trying to figure out how to
    deal with now. Here's what's happening when I compile at the command line...

    ....
    ....
    bcc32 program1.cpp glut32.lib

    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    program1.cpp:
    Error E2337 C:\Borland\BCC55\include\GL/glut.h 146: Only one of a set of overloaded functions can be "C"
    Error E2015 program1.cpp 47: Ambiguity between 'std::exit(int)' and 'exit(int)'
    in function keyboard(unsigned char,int,int)
    *** 2 errors in Compile ***


    Error E2337: glut.h contains the line extern "C", but it inlcudes gl.h&glu.h
    which also declare functions as extern "C". I'm not sure what
    to do here.
    Error E2015: I think the question here is whether to use exit() from Borland's standard library or the user defined exit(). I see a prototype for exit() in glut.h, but I haven't found where it is defined, so I don't know which exit() function to use here[in program1.cpp].

    I'm very thankful to everyone who has helped me so far.

    Jay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •