pinpoy | hello
[blabla]..........[/blabla]
j'ai un probleme de débutant j'ai voulu tester un programme basique dont le code provient d'un bouqin
c'est censé faire tourner un carré...
le code est le suivant
Code :
- #include <stdlib.h>
- #include <GL/gl.h>
- #include <GL/glut.h>
- static GLfloat spin = 0.0;
- void init(void)
- {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glShadeModel(GL_FLAT);
- }
- void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glPushMatrix();
- glRotatef(spin, 0.0, 0.0, 1.0);
- glColor3f(1.0 , 1.0, 1.0);
- glRectf( -25.0, -25.0, 25.0, 25.0);
- glPopMatrix();
- glutSwapBuffers();
- }
- void spinDisplay(void)
- {
- spin = spin +2.0;
- if(spin < 360.0){
- spin = spin -360.0;
- }
- glutPostRedisplay();
- }
- void reshape(int w, int h)
- {
- glViewport(0, 0, (GLsizei) w, (GLsizei)h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho( -50.0, 50.0, -50.0, 50.0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- void mouse(int button , int state, int x, int y)
- {
- switch(button){
- case GLUT_LEFT_BUTTON:
- if(state == GLUT_DOWN)
- glutIdleFunc(spinDisplay);
- break;
- case GLUT_MIDDLE_BUTTON:
- if(state == GLUT_DOWN)
- glutIdleFunc(NULL);
- break;
- default:
- break;
- }
- }
- int main(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(250, 250);
- glutInitWindowPosition(100, 100);
- glutCreateWindow(argv[0]);
- init();
- glutDisplayFunc(display);
- glutReshapeFunc(reshape);
- glutMouseFunc(mouse);
- glutMainLoop();
- return 0;
- }
|
et pour le makefile
Code :
- but : opengl
- double.o : double.cc
- g++ -c double.cc
- opengl : double.o
- g++ double.o -o prog
|
le code est bon ca compile le fichier .o mais jobtiens
Code :
- g++ double.o -o prog
- double.o(.text+0x1f): In function `init()':
- : undefined reference to `glClearColor'
- double.o(.text+0x2f): In function `init()':
- : undefined reference to `glShadeModel'
- double.o(.text+0x47): In function `display()':
- : undefined reference to `glClear'
- double.o(.text+0x4f): In function `display()':
- : undefined reference to `glPushMatrix'
- double.o(.text+0x6c): In function `display()':
- : undefined reference to `glRotatef'
- double.o(.text+0x89): In function `display()':
- : undefined reference to `glColor3f'
- double.o(.text+0xa9): In function `display()':
- : undefined reference to `glRectf'
- double.o(.text+0xb1): In function `display()':
- : undefined reference to `glPopMatrix'
- double.o(.text+0xb6): In function `display()':
- : undefined reference to `glutSwapBuffers'
- double.o(.text+0x102): In function `spinDisplay()':
- : undefined reference to `glutPostRedisplay'
- double.o(.text+0x119): In function `reshape(int, int)':
- : undefined reference to `glViewport'
- double.o(.text+0x129): In function `reshape(int, int)':
- : undefined reference to `glMatrixMode'
- double.o(.text+0x131): In function `reshape(int, int)':
- : undefined reference to `glLoadIdentity'
- double.o(.text+0x17e): In function `reshape(int, int)':
- : undefined reference to `glOrtho'
- double.o(.text+0x18e): In function `reshape(int, int)':
- : undefined reference to `glMatrixMode'
- double.o(.text+0x196): In function `reshape(int, int)':
- : undefined reference to `glLoadIdentity'
- double.o(.text+0x1c5): In function `mouse(int, int, int, int)':
- : undefined reference to `glutIdleFunc'
- double.o(.text+0x1da): In function `mouse(int, int, int, int)':
- : undefined reference to `glutIdleFunc'
- double.o(.text+0x20b): In function `main':
- : undefined reference to `glutInit'
- double.o(.text+0x218): In function `main':
- : undefined reference to `glutInitDisplayMode'
- double.o(.text+0x22d): In function `main':
- : undefined reference to `glutInitWindowSize'
- double.o(.text+0x23c): In function `main':
- : undefined reference to `glutInitWindowPosition'
- double.o(.text+0x24c): In function `main':
- : undefined reference to `glutCreateWindow'
- double.o(.text+0x261): In function `main':
- : undefined reference to `glutDisplayFunc'
- double.o(.text+0x271): In function `main':
- : undefined reference to `glutReshapeFunc'
- double.o(.text+0x281): In function `main':
- : undefined reference to `glutMouseFunc'
- double.o(.text+0x289): In function `main':
- : undefined reference to `glutMainLoop'
- collect2: ld returned 1 exit status
- make: *** [opengl] Erreur 1
|
j'ai essayé de rajouter des arguments du genre "-lgl -lglu -lglut -lm -lX11" a la commande qui compile mais elle ne l'est trouve pas
merci d'avance de maider ca doit pas etre bien dur mais bon ca bloque tout :s Message édité par pinpoy le 19-08-2005 à 15:49:36
|