AndrewGene
September 10th, 2007, 11:12 PM
I am trying to run the simplest of opengl programs...
#include <gl/libglut.h>
void mydisplay(){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv){
glutInit($argc, argv);
glutCreateWindow("simple");
glutDisplayFunc(mydisplay);
glutMainLoop();
}
...
I am typing this into the terminal
cd to the directory of the .cpp file and then type...
sudo gcc SimpleSquare3.cpp -lglut
...it however is giving me these errors...
SimpleSquare3.cpp:1:25: error: gl/libglut.h: No such file or directory
SimpleSquare3.cpp: In function ‘void mydisplay()’:
SimpleSquare3.cpp:3: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
SimpleSquare3.cpp:3: error: ‘glClear’ was not declared in this scope
SimpleSquare3.cpp:4: error: ‘GL_POLYGON’ was not declared in this scope
SimpleSquare3.cpp:4: error: ‘glBegin’ was not declared in this scope
SimpleSquare3.cpp:5: error: ‘glVertex2f’ was not declared in this scope
SimpleSquare3.cpp:9: error: ‘glEnd’ was not declared in this scope
SimpleSquare3.cpp:10: error: ‘glFlush’ was not declared in this scope
SimpleSquare3.cpp: In function ‘int main(int, char**)’:
SimpleSquare3.cpp:13: error: ‘$argc’ was not declared in this scope
SimpleSquare3.cpp:13: error: ‘glutInit’ was not declared in this scope
SimpleSquare3.cpp:14: error: ‘glutCreateWindow’ was not declared in this scope
SimpleSquare3.cpp:15: error: ‘glutDisplayFunc’ was not declared in this scope
SimpleSquare3.cpp:16: error: ‘glutMainLoop’ was not declared in this scope
any help would be appreciated thanks. I have looked up how to link to a library and read several articles but my system doesn't have the libglut.h anywhere or libglut.a/libglut.so which is what i believe i am looking for.
#include <gl/libglut.h>
void mydisplay(){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv){
glutInit($argc, argv);
glutCreateWindow("simple");
glutDisplayFunc(mydisplay);
glutMainLoop();
}
...
I am typing this into the terminal
cd to the directory of the .cpp file and then type...
sudo gcc SimpleSquare3.cpp -lglut
...it however is giving me these errors...
SimpleSquare3.cpp:1:25: error: gl/libglut.h: No such file or directory
SimpleSquare3.cpp: In function ‘void mydisplay()’:
SimpleSquare3.cpp:3: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
SimpleSquare3.cpp:3: error: ‘glClear’ was not declared in this scope
SimpleSquare3.cpp:4: error: ‘GL_POLYGON’ was not declared in this scope
SimpleSquare3.cpp:4: error: ‘glBegin’ was not declared in this scope
SimpleSquare3.cpp:5: error: ‘glVertex2f’ was not declared in this scope
SimpleSquare3.cpp:9: error: ‘glEnd’ was not declared in this scope
SimpleSquare3.cpp:10: error: ‘glFlush’ was not declared in this scope
SimpleSquare3.cpp: In function ‘int main(int, char**)’:
SimpleSquare3.cpp:13: error: ‘$argc’ was not declared in this scope
SimpleSquare3.cpp:13: error: ‘glutInit’ was not declared in this scope
SimpleSquare3.cpp:14: error: ‘glutCreateWindow’ was not declared in this scope
SimpleSquare3.cpp:15: error: ‘glutDisplayFunc’ was not declared in this scope
SimpleSquare3.cpp:16: error: ‘glutMainLoop’ was not declared in this scope
any help would be appreciated thanks. I have looked up how to link to a library and read several articles but my system doesn't have the libglut.h anywhere or libglut.a/libglut.so which is what i believe i am looking for.