Thread: How to setting up Eclipse for OpenGL

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    78

    How to setting up Eclipse for OpenGL

    Hi guys!

    I'm dealing with a very interesting new problem today:
    Setting up Eclipse for OpenGL (on a Mac OS X10.6)


    I've created a simple OpenGL program to begin with - however it is not compilable.

    The header looks the following:
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    #include <GLUT/glut.h>
    ....
    I get the following syntax error within the editor:
    Unresolved inclusion: <GLUT/glut.h>
    And after the build, I receive even more errors:
    Undefined symbols:
    "_glEnd", referenced from:
    _display in hello.o
    "_glFlush", referenced from:
    _display in hello.o
    ......
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [Hello] Error 1
    **** Build Finished ****
    There seems to be a linking problem. Eclipse isn't able to recognize the header files and thus the OpenGL code.
    I tried troubleshooting using the suggestions from the following link, but things didn't work out.


    Any Suggestions?






    Last edited by in_ship; 08-26-2012 at 02:04 PM.

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    it appears you don't have glut installed on your system, or at least not visible to your development environment.
    search your hard drive for 'glut.h'. if it isn't there, you don't have glut installed. install it. i'm not a mac guy, so i can't help there.
    if it is there, then you need to add that directory to your file include path in the project settings or makefile.
    for the unresolved symbols, you need to do a similar thing for the glut libraries.

  3. #3
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    Quote Originally Posted by dmh2000 View Post
    it appears you don't have glut installed on your system, or at least not visible to your development environment.
    search your hard drive for 'glut.h'. if it isn't there, you don't have glut installed. install it.
    It is actually. According to the troubleshooting link above (and I confirmed this), the GLUT and OpenGL frameworks lie in the paths:
    /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/
    /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/GLUT.framework/Versions/A/Libraries/
    All the necessary libraries are in there.
    But, how to access them?

  4. #4
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Presumably you have not added these to your include and library paths. Search around in your IDE for a place to do that.

    Library directories are usually called lib while include directories are usually called include. You need to add both for OpenGL and GLUT.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  5. #5
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    I added the full path to the header files this time and the errors vanished from the workbench.
    Code:
    #include </Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h>
    #include </Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/glu.h>
    #include </Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/GLUT.framework/Headers/glut.h>
    Instead, I received an autoconfig error:
    Invoking autoreconf in build directory: /username/.../programname

    sh -c autoreconf -i
    autoreconf: `configure.ac' or `configure.in' is required

    Configuration failed with error

  6. #6
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    No suggestions whatsoever?

  7. #7
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Apparently, not many people are using Eclipse.

    Your solution in post 5 is not very good. You should add the "Headers" directories in the proper place in your IDE (search around). You also need to add the "lib" (or whatever) directories in the proper place. Your original problem was not with the linker, but you will get a linker problem the way it is now. I'm not sure what's up with autoreconf but try fixing the directory problem first.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  8. #8
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Eclipse is a massive pain in the arse in my opinion - choose a dedicated c / c++ ide instead
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  9. #9
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    I tried something else again (this time in Eclipse Juno).
    For the following properties:

    Projectname > Properties > C/C++ General > Paths and Symbols > GNU C > Includes
    Projectname > Properties > C/C++ General > Paths and Symbols > GNU C++ > Includes
    I've added both necessary Header paths.
    /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/
    /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/GLUT.framework/Versions/A/Headers/
    However, after building, I get another strange error this time:
    **** Build of configuration Build (GNU) for project Hello ****

    make all
    make: *** No rule to make target `all'. Stop.

    **** Build Finished ****
    Where is this coming from now?
    Last edited by in_ship; 08-28-2012 at 01:21 PM.

  10. #10
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    Quote Originally Posted by rogster001 View Post
    Eclipse is a massive pain in the arse in my opinion - choose a dedicated c / c++ ide instead
    I have a couple of other projects in Eclipse which I would like to combine with OpenGL. Thus - the choice - Eclipse.

  11. #11
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    I know nothing of Eclipse, but you seem to have added the "Libraries" directories in the wrong place. The Includes property should have the "Headers" directories added to it. The "Libraries" directories should be added elsewhere (perhaps in a property called "Libraries"). They are two very different things and both are needed. Keep looking!
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  12. #12
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    Quote Originally Posted by oogabooga View Post
    I know nothing of Eclipse, but you seem to have added the "Libraries" directories in the wrong place. The Includes property should have the "Headers" directories added to it. The "Libraries" directories should be added elsewhere (perhaps in a property called "Libraries"). They are two very different things and both are needed. Keep looking!
    AH - there's a typo in my post. It's
    /Headers/
    ofcourse.
    Edited post above.

    Where do you add library paths in Eclipse Juno?
    Last edited by in_ship; 08-28-2012 at 01:28 PM.

  13. #13
    Registered User
    Join Date
    Aug 2012
    Posts
    78
    I figured out how to make it run on Eclipse Indigo.
    In case anyone is interested, here's a tutorial on how to setup OpenGL for it: Link
    Last edited by in_ship; 08-28-2012 at 02:30 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [OpenGL] Best approach to setting every pixel's color
    By Antony Kossoski in forum Game Programming
    Replies: 3
    Last Post: 04-16-2012, 07:21 PM
  2. Little help setting up OpenGL
    By manasij7479 in forum Tech Board
    Replies: 2
    Last Post: 10-19-2011, 03:34 PM
  3. Eclipse C++ problem
    By Nextstopearth in forum Tech Board
    Replies: 8
    Last Post: 04-05-2009, 12:37 AM
  4. setting up opengl for windows xp
    By dragonlady in forum C++ Programming
    Replies: 3
    Last Post: 01-03-2006, 02:47 AM
  5. Help setting up OpenGL using Borland command line tools
    By Unregistered in forum Game Programming
    Replies: 2
    Last Post: 07-19-2002, 10:08 AM