problème de compilation

problème de compilation - Débats - Linux et OS Alternatifs

Marsh Posté le 12-10-2002 à 00:19:42    

voici le code  
 
il fonctionne avec borlanc c++
 
#include<iostream.h>
#include<math.h>
 
int a;
int b;
int c;
float delta;
 
int main()
{
 
cout<<"calcul de racines d'equations du 2nd degre : aX^2+bX+c = 0\n";
cout<<"entrez a\n";
cin>>a;
cout<<"entrez b\n";
cin>>b;
cout<<"entrez c\n";
cin>>c;
delta = b*b-4*a*c;
if (delta>0) {  
   cout<<"2 racines\n";
   cout<<"premiere racine: "<<(-b-sqrt(delta))/2<<"\n";
   cout<<"deuxieme racine: "<<(-b+sqrt(delta))/2<<"\n";
  }
 
else if (delta == 0) { cout<<"racines double: "<< -b/2;}  
else  { cout<<"pas de raciens reelles";}
 
}
 
 
lorsque je fais gcc racines, j'ai les erreurs suivantes
 
 
linux:/home/marc # gcc racines.cpp
/tmp/ccqZp2dW.o: In function `main':
/tmp/ccqZp2dW.o(.text+0xf): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x14): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x24): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x29): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x39): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x3e): undefined reference to `istream::o perator>>(int &)'
/tmp/ccqZp2dW.o(.text+0x4e): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x53): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x63): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x68): undefined reference to `istream::o perator>>(int &)'
/tmp/ccqZp2dW.o(.text+0x78): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x7d): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x8d): undefined reference to `cin'
/tmp/ccqZp2dW.o(.text+0x92): undefined reference to `istream::o perator>>(int &)'
/tmp/ccqZp2dW.o(.text+0xec): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0xf1): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x123): undefined reference to `sqrt'
/tmp/ccqZp2dW.o(.text+0x146): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x14b): undefined reference to `ostream::o perator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x156): undefined reference to `ostream::o perator<<(double)'
/tmp/ccqZp2dW.o(.text+0x161): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x193): undefined reference to `sqrt'
/tmp/ccqZp2dW.o(.text+0x1b6): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x1bb): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x1c6): undefined reference to `ostream::operator<<(double)'
/tmp/ccqZp2dW.o(.text+0x1d1): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x215): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x21a): undefined reference to `ostream::operator<<(char const *)'
/tmp/ccqZp2dW.o(.text+0x225): undefined reference to `ostream::operator<<(int)'
/tmp/ccqZp2dW.o(.text+0x239): undefined reference to `cout'
/tmp/ccqZp2dW.o(.text+0x23e): undefined reference to `ostream::operator<<(char const *)'
collect2: ld returned 1 exit status
linux:/home/marc #

Reply

Marsh Posté le 12-10-2002 à 00:19:42   

Reply

Marsh Posté le 12-10-2002 à 00:22:46    

il a vraisemblablement pas charger iostream et math...


---------------
"Je brandirai une épée d'orichalque, je m'assouvirai sur des Templiers." | "Avec dans son sillage l'Ombre du Diable, Leirn appelait les morts pour une danse macabre et déchainaît les horreurs de la nuit..."
Reply

Marsh Posté le 12-10-2002 à 00:51:27    

avec g++ ?
 
PS: man de gcc ==>  
 
       gcc    assumes preprocessed (.i) files are C  and  assumes  C  style
              linking.
 
       g++    assumes preprocessed (.i) files are C++ and assumes C++ style
              linking.


Message édité par R@NNIS le 12-10-2002 à 00:55:40

---------------
Mes News
Reply

Marsh Posté le 12-10-2002 à 00:57:08    

R@NNIS a écrit a écrit :

avec g++ ?
 
PS: man de gcc ==>  
 
       gcc    assumes preprocessed (.i) files are C  and  assumes  C  style
              linking.
 
       g++    assumes preprocessed (.i) files are C++ and assumes C++ style
              linking.
 




 
j'avais meme po vu :/


---------------
"Je brandirai une épée d'orichalque, je m'assouvirai sur des Templiers." | "Avec dans son sillage l'Ombre du Diable, Leirn appelait les morts pour une danse macabre et déchainaît les horreurs de la nuit..."
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed