I have a Mac Snow Leopard (version 10.6.5) and Xcode installed (version 3.2.4; 64 bit).
I am new to Open GL and am just getting started; trying to create my first app.
Since I do not know objective C, I thought I would start using GLUT.
I am just trying to draw a black window.
Steps I followed:
-
Created a new project with and selected “Cocoa Application”
-
In the Linked Framedworks, added OpenGL and GLUT; deleted Cocoa
-
Created a main.c and pasted the following code
#include <stdlib.h>
#include <GLUT/glut.h>
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSwapBuffers();
}
void reshape(int width, int height)
{
glViewport(0, 0, width, height);
}
void idle(void)
{
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutCreateWindow("GLUT Program");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(idle);
glutMainLoop();
return EXIT_SUCCESS;
}
- Did a build and run but get the following linking error:
ld: duplicate symbol _main in /Users/NewOglUser/Scratch/OGL/XcodeGLUT/build/XcodeGLUT.build/Debug/XcodeGLUT.build/Objects-normal/x86_64/main-C7DF8B59B4D4D553.o and /Users/cheenu/Scratch/OGL/XcodeGLUT/build/XcodeGLUT.build/Debug/XcodeGLUT.build/Objects-normal/x86_64/main-B9843B6026D6EFA4.o
Any ideas on what I am missing?
Should I be going this route or just go through the pain of learning minimal objective C first?
My aim is to get an understanding of OpenGL (fairly new to 3D) and hence I am trying to write some apps to understand the spec.
Thanks very much for any help and advice on this!