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 3 123 LastLast
Results 1 to 10 of 22

Thread: GLUT and macro redefinition errors

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    11

    GLUT and macro redefinition errors

    Hello, I hope this post is in the right section. I've just been trying to get GLUT working with Pelles C using the example code at http://www.trajectorylabs.com/gettin...engl_glut.html

    This is my second attempt at getting GLUT to work after being totally baffled the first time a while back, and not managing to solve the problem by inquiring on the Pelles C forum, which to compound the problem I can't even access at the moment for some reason!

    Upon compiling I get just the following two errors:
    Building myfirst.obj.
    C:\Program Files\PellesC\Include\gl\glut.h(19): error #1050: Macro redefinition of 'APIENTRY'.
    C:\Program Files\PellesC\Include\gl\glut.h(20): error #1050: Macro redefinition of 'CALLBACK'.
    *** Error code: 1 ***


    As far as I can see, I have put all the right files in the right places and ticked the right boxes in the project options (e.g. allow microsoft extensions), and after searching the web for F.A.Q.s I can't find the above errors being addressed. I should stress that although being able to program some C I'm no expert at all this stuff so I could still be doing something stupid I guess.

    Any thoughts? Thanks very much.

    Andy

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: GLUT and macro redefinition errors

    Macro redefinition of 'APIENTRY'.
    : it looks like you have #include of other things before glut. glut.h should (almost) be the only include.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    11

    Re: GLUT and macro redefinition errors

    Hmm, I've just got the following (full code is in the link I posted)

    #include <windows.h>
    #include <gl\gl.h>
    #include <gl\glut.h>

    Then it goes on to prototypes.

    So there's not much to go wrong with. I've tried selectively taking each one out to see what happens. Unsurprisingly it tells me to "imporve myself" after casuing more than 100 errors!

    This is really frustrating, I haven't even made OpenGL draw a box yet!

    Could it be something to do with Windows Vista?

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: GLUT and macro redefinition errors

    Not Vista, it is more your tool chain that needs some tweaking.
    compiler/IDE/libs ?

    For simple beginner stuff I found dev-c++ is really great, as you can even get sample code projects for OpenGL win win32, with glut, SDL, whatever, directly from the IDE itself.

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    11

    Re: GLUT and macro redefinition errors

    Tweaking the compiler and libraries and stuff... oh dear, not one of my strong points! I'm playing round with various project options at the moment but frankly I don't really know what I'm doing.

  6. #6
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    11

    Re: GLUT and macro redefinition errors

    Here's a thought: if I uninstall PellesC and then reinstall, then redownload the appropriate GLUT files - can there be anything that I'd have to change... surely it should work....

  7. #7
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: GLUT and macro redefinition errors

    then don't waste time :
    http://www.bloodshed.net/dev/devcpp.html

    Within Dev-C++, in menu Tools, Check for updates/packages, then community packs or something. I recommend the freeglut examples (modern opensource GLUT).
    Then File, new project, multimedia tab, freeglut. F9. It works.

  8. #8
    Junior Member Newbie
    Join Date
    Nov 2007
    Posts
    11

    Re: GLUT and macro redefinition errors

    Ok ZbufferR, I'll give it a try... although I'll need to learn C++, but that was always going to be necessary eventually, trundling along as I am with plain old C.

  9. #9
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: GLUT and macro redefinition errors

    No worries, despite its name, in fact Dev-C++ let you choose between C or C++, for each project.

  10. #10
    Member Regular Contributor
    Join Date
    Oct 2006
    Posts
    349

    Re: GLUT and macro redefinition errors

    Only problem with Dev-C++ is that it's, well, dead.

    Code::Blocks is a more modern effort, by one of the original developers of Dev-C++.

Posting Permissions

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