Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1822 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Débats

  [LINUX] Probleme OpenGL en C

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[LINUX] Probleme OpenGL en C

n°176149
AsTro
Posté le 20-10-2002 à 18:22:25  profilanswer
 

Je susi sous debian, j'ai bien installé Mesa pour avoir les librairies opengl, j'ai suivi le 1er tuto sur linuxgraphic.org et j'ai l'erreur :
 
ogl1.c: In function `main':
ogl1.c:20: parse error before `;'
 
lors de la compilation du fichier suivant (voici le debut):
 
 

Code :
  1. /********************************************************/
  2. /*                      ogl1.c                          */
  3. /********************************************************/
  4. /* Premiers pas avec OpenGL.                            */
  5. /* Objectif : afficher a l'ecran un carre en couleur    */
  6. /********************************************************/
  7. /* inclusion des fichiers d'en−tete Glut */
  8. #include <GL/glut.h>
  9. void affichage();
  10. void clavier(unsigned char touche,int x,int y);
  11. int main(int argc,char **argv)
  12. {
  13. /* initialisation de glut et creation
  14. de la fenetre */
  15. glutInit(
  16. glutInitDisplayMode(GLUT_RGB); <-- voila la ligne 20
  17. glutInitWindowPosition(200,200);
  18. glutInitWindowSize(250,250);
  19. glutCreateWindow("ogl1" );
  20. /* Initialisation d'OpenGL */
  21. glClearColor(0.0,0.0,0.0,0.0);


 
 
je comprend pas je n'ai fait que recopier leur fichier d'exemple.
Si quelqu'un pouvait m'aider ca serait tres sympa


Message édité par AsTro le 20-10-2002 à 18:24:20
mood
Publicité
Posté le 20-10-2002 à 18:22:25  profilanswer
 

n°176152
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 18:23:50  profilanswer
 

il manque &argc,argv); après glutinit (
 
C'est une question de C, pas sur un OS Alternatif


Message édité par kadreg le 20-10-2002 à 18:26:41

---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
n°176162
AsTro
Posté le 20-10-2002 à 18:30:55  profilanswer
 

nop c pas ca parce ke si tu veux c plutot comme ca :
 
 

Code :
  1. int main(int argc,char **argv)
  2. {
  3. /* initialisation de glut et creation  
  4. de la fenetre */
  5. glutInit(
  6.            glutInitDisplayMode(GLUT_RGB);
  7.            glutInitWindowPosition(200,200);
  8.            glutInitWindowSize(250,250);
  9.            glutCreateWindow("ogl1" );
  10.            /* Initialisation d'OpenGL */
  11.            glClearColor(0.0,0.0,0.0,0.0);
  12.            glColor3f(1.0,1.0,1.0);
  13.            glPointSize(2.0);
  14.            /* enregistrement des fonctions de rappel */
  15.            glutDisplayFunc(affichage);
  16.            glutKeyboardFunc(clavier);
  17.            /* Entree dans la boucle principale glut */
  18.            glutMainLoop();
  19.            return 0;
  20. }


 
et si je met ); j'ai le droit a l'erreur :
 
ogl1.c: In function `main':
ogl1.c:19: too few arguments to function `glutInit'
 

n°176163
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 18:32:42  profilanswer
 

Astro a écrit a écrit :

nop c pas ca parce ke si tu veux c plutot comme ca :




 
non.
 
Tu connais le C ?  
 
http://linuxgraphic.org/section3d/ [...] idac8.html


---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
n°176164
axey
http://www.00f.net
Posté le 20-10-2002 à 18:33:32  profilanswer
 

Mets ca:
 
glutInit(&argc, &argv);
glutInitDisplayMode(GLUT_RGB);  
glutInitWindowPosition(200,200);  
glutInitWindowSize(250,250);  
 
etc.


---------------
C'est en forgeant qu'on devient con comme un forgeron.
n°176165
AsTro
Posté le 20-10-2002 à 18:38:13  profilanswer
 

axey a écrit a écrit :

Mets ca:
 
glutInit(&argc, &argv);
glutInitDisplayMode(GLUT_RGB);  
glutInitWindowPosition(200,200);  
glutInitWindowSize(250,250);  
 
etc.




encore une erreur :( :
 
ogl1.c: In function `main':
ogl1.c:19: warning: passing arg 2 of `glutInit' from incompatible pointer type
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status

n°176166
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 18:40:35  profilanswer
 

Pour le warning, c'est argv, pas &argv pour glutInit
 
Pour la seconde, je te dit la réponse après avoir booté la debian


Message édité par kadreg le 20-10-2002 à 18:40:48

---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
n°176168
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 18:45:45  profilanswer
 

apt-get install glutg3


---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
n°176174
AsTro
Posté le 20-10-2002 à 18:57:57  profilanswer
 

kadreg a écrit a écrit :

 
 
non.
 
Tu connais le C ?  
 
http://linuxgraphic.org/section3d/ [...] idac8.html




 
 
sur le pdf qu'ils proposent en téléchargement il y a le code que j'ai mis au début du topic.
En faisant un gcc tout simple j'ai:
 
astro@hdb-draco:~/prog$ gcc ogl1.c
/tmp/ccZxh8hG.o: In function `main':
/tmp/ccZxh8hG.o(.text+0x12): undefined reference to `glutInit'
/tmp/ccZxh8hG.o(.text+0x1f): undefined reference to `glutInitDisplayMode'
/tmp/ccZxh8hG.o(.text+0x34): undefined reference to `glutInitWindowPosition'
/tmp/ccZxh8hG.o(.text+0x49): undefined reference to `glutInitWindowSize'
/tmp/ccZxh8hG.o(.text+0x59): undefined reference to `glutCreateWindow'
/tmp/ccZxh8hG.o(.text+0x69): undefined reference to `glClearColor'
/tmp/ccZxh8hG.o(.text+0x83): undefined reference to `glColor3f'
/tmp/ccZxh8hG.o(.text+0x9a): undefined reference to `glPointSize'
/tmp/ccZxh8hG.o(.text+0xaa): undefined reference to `glutDisplayFunc'
/tmp/ccZxh8hG.o(.text+0xba): undefined reference to `glutKeyboardFunc'
/tmp/ccZxh8hG.o(.text+0xc2): undefined reference to `glutMainLoop'
/tmp/ccZxh8hG.o: In function `affichage':
/tmp/ccZxh8hG.o(.text+0xe3): undefined reference to `glClear'
/tmp/ccZxh8hG.o(.text+0xf0): undefined reference to `glBegin'
/tmp/ccZxh8hG.o(.text+0x104): undefined reference to `glColor3f'
/tmp/ccZxh8hG.o(.text+0x127): undefined reference to `glVertex2f'
/tmp/ccZxh8hG.o(.text+0x13b): undefined reference to `glColor3f'
/tmp/ccZxh8hG.o(.text+0x15e): undefined reference to `glVertex2f'
/tmp/ccZxh8hG.o(.text+0x172): undefined reference to `glColor3f'
/tmp/ccZxh8hG.o(.text+0x195): undefined reference to `glVertex2f'
/tmp/ccZxh8hG.o(.text+0x1af): undefined reference to `glColor3f'
/tmp/ccZxh8hG.o(.text+0x1d2): undefined reference to `glVertex2f'
/tmp/ccZxh8hG.o(.text+0x1da): undefined reference to `glEnd'
/tmp/ccZxh8hG.o(.text+0x1df): undefined reference to `glFlush'
/tmp/ccZxh8hG.o: In function `clavier':
/tmp/ccZxh8hG.o(.text+0x22e): undefined reference to `glPolygonMode'
/tmp/ccZxh8hG.o(.text+0x236): undefined reference to `glutPostRedisplay'
/tmp/ccZxh8hG.o(.text+0x24e): undefined reference to `glPolygonMode'
/tmp/ccZxh8hG.o(.text+0x256): undefined reference to `glutPostRedisplay'
/tmp/ccZxh8hG.o(.text+0x26e): undefined reference to `glPolygonMode'
/tmp/ccZxh8hG.o(.text+0x276): undefined reference to `glutPostRedisplay'
collect2: ld returned 1 exit status

n°176176
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 19:00:56  profilanswer
 

http://linuxgraphic.org/section3d/ [...] idac7.html


---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
mood
Publicité
Posté le 20-10-2002 à 19:00:56  profilanswer
 

n°176177
AsTro
Posté le 20-10-2002 à 19:02:10  profilanswer
 

kadreg a écrit a écrit :

Pour le warning, c'est argv, pas &argv pour glutInit
 
Pour la seconde, je te dit la réponse après avoir booté la debian




j'ai eu cette erreur car je fais ca :
 
 gcc ogl1.c -o ogl -L/usr/X11R6/lib -lGL -lGLU -lglut -lX
11 -lXmu -lXi -lm
 
mais je sais pas si s'est obligatoire?

n°176180
kadreg
profil: Utilisateur
Posté le 20-10-2002 à 19:04:49  profilanswer
 

AsTro a écrit a écrit :

 
mais je sais pas si s'est obligatoire?




 
Si, puisque tu utilises les fonctions de glut.
 
Tu as bien installé glut au moins ?
 
 apt-get install glutg3


---------------
brisez les rêves des gens, il en restera toujours quelque chose...  -- laissez moi troller sur discu !
n°176185
AsTro
Posté le 20-10-2002 à 19:21:08  profilanswer
 

kadreg a écrit a écrit :

 
 
Si, puisque tu utilises les fonctions de glut.
 
Tu as bien installé glut au moins ?
 
 apt-get install glutg3




 
Oui m'sieur c installé pourtant mais me manque ptet un truc  :heink:

n°176198
AsTro
Posté le 20-10-2002 à 19:59:50  profilanswer
 

Plus personne pour me dire pourquoi j'ai cette erreur :
 
/usr/bin/ld: cannot find -lglut
collect2: ld returned 1 exit status

n°176227
axey
http://www.00f.net
Posté le 20-10-2002 à 21:14:04  profilanswer
 

Il se trouve ou, ton fichier libglut.so?


---------------
C'est en forgeant qu'on devient con comme un forgeron.
n°176241
AsTro
Posté le 20-10-2002 à 21:33:50  profilanswer
 

je n'ai qu'un fichier libglut.so.3 pas de .so tout court.
et il est dans /usr/lib.
et jai fait gcc -L/usr/lib masi ca marche pas non plus.

n°176242
kjus
Posté le 20-10-2002 à 21:34:25  profilanswer
 

faut ptet lancer un ldconfig ? (en root)

n°176272
AsTro
Posté le 20-10-2002 à 22:24:45  profilanswer
 

les so.3 et les so s'est la meme chose?
 
j'ai fait ldconfig mais ca a rien changer.
il doit me renvoyer quelque chose à l'écran ldconfig?
aussi dans /etc/ld.so.conf j'avais :  
/usr/X11R6/lib
et j'ai ajouté :
/usr/lib
 

n°176503
AsTro
Posté le 21-10-2002 à 12:31:46  profilanswer
 

:bounce:

n°176522
bb138
La vie est belle ...
Posté le 21-10-2002 à 13:21:13  profilanswer
 

Tu n'es pas vraiment où il faut ici !
 
Sinon tu peux essayer de faire un :
ln -s /usr/lib/libglut.so.3 /usr/lib/libglut.so
 
On ne sait jamais...


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Débats

  [LINUX] Probleme OpenGL en C

 

Sujets relatifs
[Linux] Existe t il un clone de Nero DriveSpeed ?Quelques questions fondamenrales pour linux!!!
Editeur html wysiwyg sous linux ??Linux sur un inspiron 2650, question sur les partitions
calcul formel sous linuxLinux dans la Bande Dessinée
un prog pour faire de l'analyse MERISE sous linuxLinux + NTFS ???
une fois de plus : modem adsl SAGEM et linuxvoir partition linux sous win 2k ?
Plus de sujets relatifs à : [LINUX] Probleme OpenGL en C


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR