Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help just compiling OpenGL files in C

Help just compiling OpenGL files in C
Thread Tools
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 2, 2004, 10:13 PM
 
K, to get a better grasp of texture mapping with another library, I'm going through some quick OpenGL examples in C, however, they fail to compile on my system because of something.

The problem isn't the code since even Apple's examples fail to compile, but I think it has to do with a library not being included.

Here's what I have:
Code:
/* For Core Graphics */ #include <ApplicationServices/ApplicationServices.h> /* For CGL */ #include <OpenGL/OpenGL.h> #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <GLUT/glut.h> #include <OpenGL/glext.h> #include <Carbon/Carbon.h>
I get the following error after doing a 'cc thing.c'
Code:
ld: Undefined symbols: _CGAssociateMouseAndMouseCursorPosition _CGDisplayCapture _CGDisplayHideCursor _CGDisplayMoveCursorToPoint _CGDisplayRestoreColorSyncSettings _CGDisplayShowCursor _CGGetDisplayTransferByFormula _CGLChoosePixelFormat blah blah blah...
What should I do?
     
Mac Enthusiast
Join Date: Jul 2002
Status: Offline
Reply With Quote
Sep 3, 2004, 02:26 AM
 
Anytime you have a linker (ld) error like this, you need to link against the library that contains the symbols.

In this case, the OpenGL framework. Add it to your Xcode project, or if you're compiling from the shell add "-framework OpenGL".

Similarly you need "-framework GLUT" for GLUT stuff, and that depends on Objective-C internally so you also need -lobjc (or -framework Cocoa).
     
Professional Poster
Join Date: Oct 2001
Status: Offline
Reply With Quote
Sep 3, 2004, 09:37 AM
 
Originally posted by arekkusu:
Anytime you have a linker (ld) error like this, you need to link against the library that contains the symbols.

In this case, the OpenGL framework. Add it to your Xcode project, or if you're compiling from the shell add "-framework OpenGL".

Similarly you need "-framework GLUT" for GLUT stuff, and that depends on Objective-C internally so you also need -lobjc (or -framework Cocoa).
Thanks a bunch! I normally program in Java so this C library stuff escapes me.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:13 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2