 |
 |
Error for openGL program,please help
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2004
Status:
Offline
|
|
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
void display(void)
{
// clear all pixels in frame buffer
glClear(GL_COLOR_BUFFER_BIT);
// draw a red wireframe of a teapot
glColor3f (1.0, 0.0, 0.0); // (red,green,blue) colour components
glutWireTeapot(0.6);
// start processing buffered OpenGL routines
glFlush ();
}
void init (void)
{
// select clearing color (for glClear)
glClearColor (1.0, 1.0, 1.0, 0.0);
// initialize view (simple orthographic projection)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}
// create a single buffered 250x250 pixels big colour window
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow("My first OpenGL program");
init (); // initialise view
glutDisplayFunc(display); // draw scene
glutMainLoop();
return 0; // ANSI C requires main to return int
}
|
|
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2004
Status:
Offline
|
|
and i have got the following Error message:
dyld: /Users/maCCer/Cs Study/c+++/build/c+++ can't open library: /Users/maCCer/c+++/build/c+++.build/c+++.build/Objects-normal/ppc/libstdc++_ZeroLink.dylib (No such file or directory, errno = 2)
c+++ has exited due to signal 5 (SIGTRAP).
|
|
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Sep 2003
Location: San Diego
Status:
Offline
|
|
Did you get this fixed? I was able to get your code to run by making the following changes...
1. Turn off "Zerolink" I don't know if it is incompatible with OpenGL, but it is incompatible with some libraries. (To turn it off, select your project name from the left hand window, and then "Get Info" There is a checkbox for ZeroLink in the "Styles" menu)
2. Add the OpenGL, GLUT and Cocoa frameworks to the "External Frameworks" folder.
It will take noticably longer to build now that Zerolink is off, but it should run fine... (It took me awhile to figure all of this out!)
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2001
Status:
Offline
|
|
I don't think you need to turn off Zerolink. I get OpenGL and GLUT to run fine by including the GLUT framework. I get a different error when I run your code than you do, but just putting in the framework fixes that. This is how I've done all my programs.
~ Endeavor
|
|
Powerbook G4 400 / 10.3.7
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2004
Status:
Offline
|
|
Originally posted by Endeavor:
I don't think you need to turn off Zerolink. I get OpenGL and GLUT to run fine by including the GLUT framework. I get a different error when I run your code than you do, but just putting in the framework fixes that. This is how I've done all my programs.
~ Endeavor
Can u tell me step by step, i am really new to openGL, thanks in adavnce
|
|
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Aug 2004
Status:
Offline
|
|
Originally posted by smitty825:
Did you get this fixed? I was able to get your code to run by making the following changes...
1. Turn off "Zerolink" I don't know if it is incompatible with OpenGL, but it is incompatible with some libraries. (To turn it off, select your project name from the left hand window, and then "Get Info" There is a checkbox for ZeroLink in the "Styles" menu)
2. Add the OpenGL, GLUT and Cocoa frameworks to the "External Frameworks" folder.
It will take noticably longer to build now that Zerolink is off, but it should run fine... (It took me awhile to figure all of this out!)
thx for doing that, do you think i really need to turnoff the Zerolink?As that code is the sample solution form VS.Net, Do you think that is why the program got that error?
|
|
There were once four people named Everybody, Somebody, Nobody and Anybody. Somebody had to do a job, but Nobody wanted to do it. Nobody could see that Anybody could do it, and Somebody got angry about that because it was Everybody's job. Nobody ended up doing it, and it so happened that Everybody blamed Somebody when Nobody did what Anybody could have done.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Sep 2003
Location: San Diego
Status:
Offline
|
|
Originally posted by maCCer:
thx for doing that, do you think i really need to turnoff the Zerolink?As that code is the sample solution form VS.Net, Do you think that is why the program got that error?
Try it without Zerolink. Once it builds and runs, then you can turn Zerolink back on. Then you'll know for sure if Zerolink is the problem or not.
GLUT-based applications should be pretty much the same regardless of what platform they run on. I really think that you most likely ran into this issue because you didn't have the correct frameworks included.
(To add the framework, control + click on the "External Frameworks and Libraries" folder in your code's main window. Select the 'Add->Existing Frameworks..." You should see the GLUT, OpenGL & Cocoa Frameworks in the /System/Library/Frameworks directory)
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Feb 2001
Location: Deer Crossing, CT
Status:
Offline
|
|
XCode has two default build styles, one for development and one for deployment. If you select the deployment build style this will disable zerolink. Zerolink is how you can "fix & continue" while developing, but you don't actually build a complete application, you still need to run within XCode. Change to deployment build style to build a complete standalone executable file.
I learned this the hard way the first time I tried to distribute my Musical Scales program.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|