Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 25/05/2007, à 14:50

mathusard

Makefile qui marche pas...

Hello,
jusqu'à présent, tout fonctionnait très bien, je compilais mes programmes sous Emacs.
Et désormais que je fais des makefile, lorsque je tape la commande make dans le terminal, j'ai plein d'erreurs de compilation du style "osteam<char..." enfin comme si à la compilation, la libraire n'était pas prise en compte.
Je ne suis pas un pro désolé , merci de m'aider, c'est assez important -> projet d'info de fin d'année smile
Merci d'avance

PS : en effet, ce ne sont que des "undefined reference to 'std:..."

Dernière modification par mathusard (Le 25/05/2007, à 14:59)

Hors ligne

#2 Le 25/05/2007, à 15:19

csoler

Re : Makefile qui marche pas...

essaye de rajouter -lstdc++ au link.

CsoL


Mon projet chou: http://retroshare.sourceforge.net
(Voir aussi la page ubuntu-fr: http://doc.ubuntu-fr.org/retroshare)

Hors ligne

#3 Le 25/05/2007, à 16:31

mathusard

Re : Makefile qui marche pas...

re !
en fait, c'est le makefile qui péchait un peu... j'ai un peu du mal à voir pourquoi car sur les ordis de l'école, tout marchait bien, enfin...
J'ai un nouveau problème, j'utilise glut dans mon programme et apparement, ça ne marche pas à la compilation :

mathieu@mathieu-laptop:~/cpp/projet$ make
g++ -O2 -ansi -pedantic -Wall -g   -c -o exerciceP13.o exerciceP13.cc
exerciceP13.cc:1:21: error: GL/glut.h: No such file or directory
Cases.h:10: error: expected class-name before ‘{’ token
exerciceP13.cc: In function ‘int main(int, char**)’:
exerciceP13.cc:32: error: ‘glutInit’ was not declared in this scope
exerciceP13.cc:33: error: ‘GLUT_RGBA’ was not declared in this scope
exerciceP13.cc:33: error: ‘GLUT_DOUBLE’ was not declared in this scope
exerciceP13.cc:33: error: ‘GLUT_DEPTH’ was not declared in this scope
exerciceP13.cc:33: error: ‘glutInitDisplayMode’ was not declared in this scope
exerciceP13.cc:34: error: ‘glutInitWindowSize’ was not declared in this scope
exerciceP13.cc:40: error: ‘glutDisplayFunc’ was not declared in this scope
exerciceP13.cc:41: error: ‘glutIdleFunc’ was not declared in this scope
exerciceP13.cc:42: error: ‘glutKeyboardFunc’ was not declared in this scope
exerciceP13.cc:43: error: ‘glutReshapeFunc’ was not declared in this scope
exerciceP13.cc:45: error: ‘glutSpecialFunc’ was not declared in this scope
exerciceP13.cc:47: error: ‘GLUT_ELAPSED_TIME’ was not declared in this scope
exerciceP13.cc:47: error: ‘glutGet’ was not declared in this scope
exerciceP13.cc:48: error: ‘glutTimerFunc’ was not declared in this scope
exerciceP13.cc:54: error: ‘GL_DEPTH_TEST’ was not declared in this scope
exerciceP13.cc:54: error: ‘glEnable’ was not declared in this scope
exerciceP13.cc:55: error: ‘GL_LESS’ was not declared in this scope
exerciceP13.cc:55: error: ‘glDepthFunc’ was not declared in this scope
exerciceP13.cc:56: error: ‘GL_BLEND’ was not declared in this scope
exerciceP13.cc:57: error: ‘GL_SRC_ALPHA’ was not declared in this scope
exerciceP13.cc:57: error: ‘GL_ONE_MINUS_SRC_ALPHA’ was not declared in this scope
exerciceP13.cc:57: error: ‘glBlendFunc’ was not declared in this scope
make: *** [exerciceP13.o] Error 1

et les includes de mon exerciceP13 sont :
#include <GL/glut.h>
#include <cstdlib>

merci de m'aider:)

Hors ligne

#4 Le 25/05/2007, à 20:21

Link31

Re : Makefile qui marche pas...

sudo apt-get install freeglut3-dev
mathusard a écrit :

merci de m'aider:)

Mais de rien wink

Au fait, n'oublie pas -lGL -lGLU -lglut dans tes options de compilation.

Hors ligne

#5 Le 28/05/2007, à 09:52

mathusard

Re : Makefile qui marche pas...

En fait, je ne pense pas que le problème vienne réellement de là... J'ai installé pas mal de librairies et je pense que mes options de compilation de mon makefile ne sont pas trop moches...
Je ne comprends vraiment pas l'erreur que j'ai, peut être que je fais une erreur dans la synthaxe du makefile ?
voici mon makefile :

CXXFLAGS = -O2 -ansi -pedantic -Wall
CXXFLAGS = -g
LDFLAGS  = -L/usr/X11R6/lib/ -g
LDLIBS   = -lglut -lGLU -lGL -lXmu -lXi



all :exerciceP13




Dessinable.o:Dessinable.cc Dessinable.h
	c++ -c -o Dessinable.o Dessinable.cc 
GUI.o : GUI.cc GUI.h
	c++ -c -o GUI.o GUI.cc 
#Cases.o : Cases.h Cases.cc
#	c++ -c -o Cases.o Cases.cc
Particule.o: Particule.cc Particule.h
	c++ -c -o Particule.o Particule.cc 
Vecteur.o: Vecteur.cc Vecteur.h
	c++ -c -o Vecteur.o Vecteur.cc 
GLArgon.o : GLArgon.cc GLArgon.h
	c++ -c -o GLArgon.o GLArgon.cc 
GLNeon.o : GLNeon.cc GLNeon.h
	c++ -c -o GLNeon.o GLNeon.cc 
GLHelium.o : GLHelium.cc GLHelium.h
	c++ -c -o GLHelium.o GLHelium.cc 
Systeme.o:Systeme.cc Systeme.h 
	c++ -c -o Systeme.o Systeme.cc 
Enceinte.o:Enceinte.cc Enceinte.h
	c++ -c -o Enceinte.o Enceinte.cc 
exerciceP13.o : exerciceP13.cc
	c++ -c -o exerciceP13.o exerciceP13.cc
exerciceP13 : Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o 
	c++ -o exerciceP13 Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o  

	rm *.o

et voici les erreurs que j'ai :

mathieu@mathieu-laptop:~/cpp/projet$ make
c++ -c -o Dessinable.o Dessinable.cc 
c++ -c -o GUI.o GUI.cc 
c++ -c -o Particule.o Particule.cc 
c++ -c -o Vecteur.o Vecteur.cc 
c++ -c -o GLArgon.o GLArgon.cc 
c++ -c -o GLNeon.o GLNeon.cc 
c++ -c -o GLHelium.o GLHelium.cc 
c++ -c -o Systeme.o Systeme.cc 
c++ -c -o Enceinte.o Enceinte.cc 
c++ -o exerciceP13 Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o  
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
GUI.o: In function `timer(int)':
GUI.cc:(.text+0x8a): undefined reference to `glutGet'
GUI.cc:(.text+0x95): undefined reference to `temps'
GUI.cc:(.text+0xa6): undefined reference to `s'
GUI.cc:(.text+0xb0): undefined reference to `glutPostRedisplay'
GUI.cc:(.text+0xb7): undefined reference to `timer_on'
GUI.cc:(.text+0xd7): undefined reference to `glutTimerFunc'
GUI.o: In function `clavier(unsigned char, int, int)':
GUI.cc:(.text+0x106): undefined reference to `Linterface'
GUI.cc:(.text+0x111): undefined reference to `glutDestroyWindow'
GUI.o: In function `idle()':
GUI.cc:(.text+0x12b): undefined reference to `glutPostRedisplay'
GUI.cc:(.text+0x137): undefined reference to `glutIdleFunc'
GUI.o: In function `dessine()':
GUI.cc:(.text+0x14c): undefined reference to `glClear'
GUI.cc:(.text+0x151): undefined reference to `glLoadIdentity'
GUI.cc:(.text+0x157): undefined reference to `ma_camera'
GUI.cc:(.text+0x160): undefined reference to `ma_camera'
GUI.cc:(.text+0x166): undefined reference to `ma_camera'
GUI.cc:(.text+0x16c): undefined reference to `ma_camera'
GUI.cc:(.text+0x172): undefined reference to `ma_camera'
GUI.o:GUI.cc:(.text+0x178): more undefined references to `ma_camera' follow
GUI.o: In function `dessine()':
GUI.cc:(.text+0x1c1): undefined reference to `gluLookAt'
GUI.cc:(.text+0x1c6): undefined reference to `Linterface'
GUI.cc:(.text+0x1d1): undefined reference to `Linterface'
GUI.cc:(.text+0x1df): undefined reference to `Linterface'
GUI.cc:(.text+0x1eb): undefined reference to `glutSwapBuffers'
GUI.o: In function `reshape(int, int)':
GUI.cc:(.text+0x21e): undefined reference to `glMatrixMode'
GUI.cc:(.text+0x223): undefined reference to `glLoadIdentity'
GUI.cc:(.text+0x245): undefined reference to `glViewport'
GUI.cc:(.text+0x26a): undefined reference to `gluPerspective'
GUI.cc:(.text+0x276): undefined reference to `glMatrixMode'
GUI.cc:(.text+0x27b): undefined reference to `glLoadIdentity'
GUI.cc:(.text+0x281): undefined reference to `ma_camera'
GUI.cc:(.text+0x28a): undefined reference to `ma_camera'
GUI.cc:(.text+0x290): undefined reference to `ma_camera'
GUI.cc:(.text+0x296): undefined reference to `ma_camera'
GUI.cc:(.text+0x29c): undefined reference to `ma_camera'
GUI.o:GUI.cc:(.text+0x2a2): more undefined references to `ma_camera' follow
GUI.o: In function `reshape(int, int)':
GUI.cc:(.text+0x2eb): undefined reference to `gluLookAt'
GUI.o: In function `clavier_special(int, int, int)':
GUI.cc:(.text+0x30b): undefined reference to `ma_camera'
GUI.cc:(.text+0x311): undefined reference to `ma_camera'
GUI.cc:(.text+0x31c): undefined reference to `ma_camera'
GUI.cc:(.text+0x322): undefined reference to `ma_camera'
GUI.cc:(.text+0x32d): undefined reference to `ma_camera'
GUI.o:GUI.cc:(.text+0x333): more undefined references to `ma_camera' follow
GUI.o: In function `clavier_special(int, int, int)':
GUI.cc:(.text+0x10f3): undefined reference to `glutPostRedisplay'
GUI.o: In function `GUI::demarre()':
GUI.cc:(.text+0x1101): undefined reference to `glutMainLoop'
GUI.o: In function `GUI::GUI(Dessinable*)':
GUI.cc:(.text+0x111e): undefined reference to `glutCreateWindow'
GUI.o: In function `GUI::GUI(Dessinable*)':
GUI.cc:(.text+0x1142): undefined reference to `glutCreateWindow'
Particule.o: In function `Particule::dessine() const':
Particule.cc:(.text+0x819): undefined reference to `glPushMatrix'
Particule.cc:(.text+0x871): undefined reference to `glTranslated'
Particule.cc:(.text+0x88f): undefined reference to `glutSolidSphere'
Particule.cc:(.text+0x894): undefined reference to `glPopMatrix'
Particule.cc:(.text+0x8b3): undefined reference to `glBegin'
Particule.cc:(.text+0x935): undefined reference to `glVertex3f'
Particule.cc:(.text+0x95a): undefined reference to `glEnd'
GLArgon.o: In function `GLArgon::call_color() const':
GLArgon.cc:(.text+0x90): undefined reference to `glColor4d'
GLNeon.o: In function `GLNeon::call_color() const':
GLNeon.cc:(.text+0x90): undefined reference to `glColor4d'
GLHelium.o: In function `GLHelium::call_color() const':
GLHelium.cc:(.text+0x90): undefined reference to `glColor4d'
Systeme.o: In function `Systeme::Balayage()':
Systeme.cc:(.text+0x636): undefined reference to `Cases::collisions()'
Enceinte.o: In function `Enceinte::dessine() const':
Enceinte.cc:(.text+0x2ba): undefined reference to `glColor4d'
Enceinte.cc:(.text+0x2c6): undefined reference to `glBegin'
Enceinte.cc:(.text+0x2e5): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x30b): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x310): undefined reference to `glEnd'
Enceinte.cc:(.text+0x31c): undefined reference to `glBegin'
Enceinte.cc:(.text+0x342): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x371): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x376): undefined reference to `glEnd'
Enceinte.cc:(.text+0x382): undefined reference to `glBegin'
Enceinte.cc:(.text+0x3b1): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x3d7): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x3dc): undefined reference to `glEnd'
Enceinte.cc:(.text+0x3e8): undefined reference to `glBegin'
Enceinte.cc:(.text+0x40e): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x43d): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x442): undefined reference to `glEnd'
Enceinte.cc:(.text+0x44e): undefined reference to `glBegin'
Enceinte.cc:(.text+0x47d): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x4a3): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x4a8): undefined reference to `glEnd'
Enceinte.cc:(.text+0x4b4): undefined reference to `glBegin'
Enceinte.cc:(.text+0x4e3): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x519): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x51e): undefined reference to `glEnd'
Enceinte.cc:(.text+0x52a): undefined reference to `glBegin'
Enceinte.cc:(.text+0x560): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x58f): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x594): undefined reference to `glEnd'
Enceinte.cc:(.text+0x5a0): undefined reference to `glBegin'
Enceinte.cc:(.text+0x5c6): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x5f5): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x5fa): undefined reference to `glEnd'
Enceinte.cc:(.text+0x606): undefined reference to `glBegin'
Enceinte.cc:(.text+0x62c): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x65b): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x660): undefined reference to `glEnd'
Enceinte.cc:(.text+0x66c): undefined reference to `glBegin'
Enceinte.cc:(.text+0x69b): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x6d1): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x6d6): undefined reference to `glEnd'
Enceinte.cc:(.text+0x6e2): undefined reference to `glBegin'
Enceinte.cc:(.text+0x701): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x727): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x72c): undefined reference to `glEnd'
Enceinte.cc:(.text+0x738): undefined reference to `glBegin'
Enceinte.cc:(.text+0x757): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x77d): undefined reference to `glVertex3f'
Enceinte.cc:(.text+0x782): undefined reference to `glEnd'
collect2: ld returned 1 exit status
make: *** [exerciceP13] Error 1

sad quelle mine cet informatique big_smile
Merci à vous

Hors ligne

#6 Le 28/05/2007, à 10:22

toto4455

Re : Makefile qui marche pas...

c++ -o exerciceP13 Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o  
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'

dans cette ligne il te manquerais pas le exerciceP13.o qui contient le main  ?

exerciceP13 : exerciceP13.o Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o 
    c++ -o exerciceP13 exerciceP13.o Dessinable.o GUI.o Particule.o Vecteur.o GLArgon.o GLNeon.o GLHelium.o Systeme.o Enceinte.o

#7 Le 28/05/2007, à 10:31

mathusard

Re : Makefile qui marche pas...

Effectivement, c'était l'erreur de la première ligne smile faute d'étourderie, navré !
Je ne comprends pas, j'ai toujours ces "undefined reference to '...' pour toutes les fonctions de glut.
Je ne vois pas quel lien ça pourrait avoir avec mon makefile et je ne pense pas avoir oublié de librairies hmm

Hors ligne

#8 Le 28/05/2007, à 10:52

mathusard

Re : Makefile qui marche pas...

J'ai oublié de préciser, dans tous mes *.h, mes includes sont :
#include<GL/glut.h>
#include<cstdlib>
( je ne précise pas les #include<vector>,... )

Hors ligne

#9 Le 28/05/2007, à 14:46

Link31

Re : Makefile qui marche pas...

Link31 a écrit :

Au fait, n'oublie pas -lGL -lGLU -lglut dans tes options de compilation.

c++ -c -o Dessinable.o Dessinable.cc

Je ne vois pas ces options. D'accord, tu les as ajoutées au Makefile, mais les instructions qu'il contient ne prennent pas en compte les variables que tu définis au début (CXXFLAGS, LDLIBS, etc...), qui ne servent donc à rien.

Essaie d'ajouter $(CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) à la fin de chaque ligne qui commence par c++. Mais je te conseille de revoir tout ton Makefile, il est fait un peu à la va-vite.

Hors ligne