templates et erreur de compilation
bonjour,
je cherche à utiliser une fonction de la FAQ C++ mais je n'arrive pas à compiler :
utile.cc :
Code:
1 2 3 4 5 6 7 8 9
| #include "utile.hh"
template<typename T>
string all2string( const T & Value )
{
ostringstream oss;
oss << Value;
return oss.str();
} |
utile.hh :
Code:
1 2 3 4 5 6 7 8 9 10 11
| #ifndef UTILE_HH
#define UTILE_HH
#include <sstream>
using namespace std;
template<typename T>
string all2string( const T & Value );
#endif |
J'utilise cette fonction dans la classe ListeRep.
Voila l'erreur :
Code:
1 2 3 4
| listeRep.oo: In function `ListeRep::analyseDir(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
listeRep.cc:(.text+0xdb5): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> > all2string<long>(long const&)'
collect2: ld a retourné 1 code d'état d'exécution
make: *** [main] Erreur 1 |