Newbie question about Mach-O and OpenGL/GLUT

Using CodeWarrior 8 I have no problems compiling a double-clickable OpenGL GLUT app that I wrote in C for Carbon. But I want to compile the app, not using the Carbon CFM object format, but Mach-O object format, so that I can start the program from the Terminal and use third-party libraries in the .a (archive of object files) format.

Problem is, where are the Mach-O libaries for Open-GL and Glut? They’re not in Open GL SDK 1.2, or in /usr/lib. I see frameworks in /System/Library/Frameworks for:

GLUT.framework
OpenGL.framework

but the problem is that I only know C, and not C++, so I’d rather just use #include and be done with it…

Can anybody point me in the right direction with this? Thanks…

Eh?

Rather than your CFM OpenGL, GLU and GLUT libs you need the OpenGL, GLUT and Cocoa frameworks.

Rather than including <GL/gl.h> and <GL/glut.h>, you need to include <OpenGL/gl.h> and <GLUT/glut.h>.

None of the rest of your code need change.

Thank you very much OneSadCookie…it works great!! Really appreciate the help…

For those of you out there like me who don’t really know what a framework is, this worked for me:

In CW:

  1. select Project --> Set Default Target --> Mach-O C Console Final
  2. click on the Frameworks tab
  3. select Project --> Add files
    a) navigate to /System/Library/Frameworks
    b) just like OneSadCookie says, choose the OpenGL, GLUT, and Cocoa frameworks.
    c) de-select the checked boxes for classic and carbon when the dialog box comes up asking which targets you want to add the frameworks to

…Hmm, maybe I spoke too soon:
Somehow the GLUT left, middle, and right mouse buttons have disappeared (they don’t appear in the menu bar as they do for a Carbon console). Is there a quick fix for this?

Use the left, middle and right mouse buttons, respectively

If you don’t have a 3-button mouse, I believe you can use ctrl-click instead of right-click, and option-click instead of middle-click. Not entirely sure, though.

Sorry, I should have been more specific:
The popup menu/submenus associated with each of the buttons don’t appear (the Right, Left, and Middle buttons certainly still do work when you ctrl-click, opt-click, etc.)
Thanks.

They’re working for me on 10.2.3…

You’re right…upgrading to 10.2.3 works. Thanks.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.