Linking problem with Project Builder

Not sure what is going on here, but I have tried to compile two different simple GLUT examples on my mac with Project Builder.

I get this link error:

/usr/bin/ld: /usr/lib/crt1.o illegal reference to symbol: __objcInit defined in indirectly referenced dynamic library /usr/lib/libobjc.A.dylib

I have included the GLUT and OpenGL frameworks.

Any help is greatly appreciated.

Here is the code for one of those:

// Sample GLUT Program
//

#include <iostream.h>
#include <stdlib.h>
#include <GLUT/glut.h>
#include <math.h>

int height, width;

static int xOrg = 0, yOrg = 0;

// Main
int main(int ac, char** av) {
int winSizeX, winSizeY;

if(ac == 3) {
winSizeX = atoi(av[1]);
winSizeY = atoi(av[2]);
}
else { // default window size
winSizeX = 400;
winSizeY = 300;
}

width = winSizeX;
height = winSizeY;

// initialize OpenGL utility toolkit (glut)
glutInit(&ac, av);

// single disply and RGB color mapping
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // set display mode
glutInitWindowSize(winSizeX, winSizeY); // set window size
glutInitWindowPosition(0, 0); // set window position on screen
glutCreateWindow(“Sample Lab Window”); // set window title

// set background color
glClearColor(0.0, 0.0, 0.0, 0.0); // set the background to black
glClear(GL_COLOR_BUFFER_BIT); // clear the buffer

// enter the infinite main loop
glutMainLoop();

return 0; // never reached
}

Had the same problem few days ago. Took me 5 days to figure it out. The problem is that you cant have glut and carbon linked in the same program. If u want to use open gl with carbon you must use the Agl functions (apple gl) .

GLUT is a stand alone package which uses its own eventhandling. It seems incompattible with carbon.

For sample code check out: “AGL Reference 1.2.pdf” in the open gl (S)ource (D)evelopment (K)it. Or the “Carbon SetupGL” source code available from developer.apple->source code-> 3D Graphics

GLUT.framework on MacOSX uses Cocoa for its UI, and you therefore also need to link in Cocoa.framework.

GLUT is completely compatible with Carbon; there is no need to use AGL if you don’t want to – not that deanb had any Carbon code in his program…

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