PDA

View Full Version : Problem compiling


Alex893
2003.03.30, 03:25 AM
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.

Justin Brimm
2003.03.30, 03:30 AM
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 (http://zerobyzero.ca/~ktatters/) 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.

OneSadCookie
2003.03.30, 03:41 AM
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.