Problem compiling

Alex893
Unregistered
 
Post: #1
I'm new to OpenGL and I was reading the NeHe tutorial on how to start out with OpenGL on Mac OS X and I entered the code in the tutorial which was:

#include <GLUT/glut.h> // Header File For The GLut Library

#define kWindowWidth 400
#define kWindowHeight 300

GLvoid InitGL(GLvoid);
GLvoid DrawGLScene(GLvoid);
GLvoid ReSizeGLScene(int Width, int Height);

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (kWindowWidth, kWindowHeight);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);

InitGL();

glutDisplayFunc(DrawGLScene);
glutReshapeFunc(ReSizeGLScene);

glutMainLoop();

return 0;
}

I get the error:
/usr/lib/crt1.o illegal reference to symbol __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

Can anyone help me out with this? Thanks.
Quote this message in a reply
Member
Posts: 64
Joined: 2005.06
Post: #2
Did you copy the tutorial exactly? If you did, and your working in Cocoa, your going to run into problems. If you are indeed using Cocoa, I just found a very good OpenGL Cocoa site who's tutorials are designed like NeHe's. You can find it here or look for my recent topic.

If your using Java however, your going to have a lot of problems. OpenGL is C, and well, Java is Java.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
You need to add the Cocoa framework to your project (or the Foundation framework, or -lobjc to your linker flags).

The error is because GLUT on Mac OS X uses Cocoa internally to create its windows, menus, &c.
Quote this message in a reply
Post Reply