OpenGL using c/c++ in Mac OS X

kninja1

Registered
hey everyone,
I wrote a very simple program using c including the OpenGL libraries(suppose to create an app that has a window with a black backround, with a triangle and a square on it). In project builder, the program complies and runs fine (except for the fact that the backround of the window is white, should be black), but when I try to compile the program in the terminal, get
ld: Undefined symbols:
_glBegin
_glClear
_glClearColor
_glClearDepth
_glDepthFunc
_glEnable
_glEnd
_glHint
_glLoadIdentity
_glMatrixMode
_glShadeModel
_glTranslatef
_glVertex3f
_glViewport
_gluPerspective
_glutCreateWindow
_glutDisplayFunc
_glutInit
_glutInitDisplayMode
_glutInitWindowPosition
_glutInitWindowSize
_glutMainLoop
_glutReshapeFunc
I don't know why, am I missing an openGL sdk or something? oh yea, Im running mac os 10.2.8

any suggestions would be appreciated.
thanks
 
I added the "-framework OpenGL" option and I got less errors. The remaining errors are GLUT undefined symbols. So I tried
"gcc -framework OpenGL -framework GLUT main.c" and got this
ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib
I also tried "gcc -framework OpenGL GLUT main.c" but that didn't work either.
Any suggestions would be greatly appreciated.
thanks
kninja1
 
kninja1 said:
I added the "-framework OpenGL" option and I got less errors. The remaining errors are GLUT undefined symbols. So I tried
"gcc -framework OpenGL -framework GLUT main.c" and got this
ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib
I also tried "gcc -framework OpenGL GLUT main.c" but that didn't work either.
Any suggestions would be greatly appreciated.
thanks
kninja1

gcc -framework OpenGL -framework GLUT -lobjc main.c
 
Back
Top