Bonjour, j'ai un problème de "multiple definition" et je ne comprend pas trop pourquoi.

J'ai une classe Util qui a 4 fonctions, et il y en a seulement 1 d'entre elles qui posent problème (la fonction Ecrire)..


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
class Util 
{
public:
Util();
~Util();
 
template <class T>
static std::string ToStr(const T &); // Convertir en string 
 
template <class T> 
static int ToInt(const T &); // Convertir en entier
 
template <class T>
static bool FromStrToAny(const std::string&, T&); // Recoit un string et le converti en un type donné
 
static void Ecrire(const std::string &, const char*); // Écrit fichier
 
}; 
 
 
 
template <class T>
std::string Util::ToStr(const T & value) 
{
std::ostringstream oss;
oss << value;
return oss.str(); 
}
 
template <class T>
int Util::ToInt(const T & value)
{
std::istringstream iss(value);
int integer;
if (!(iss >> integer)) throw ConversionFailure();
 
return integer;
}
 
template<class T>
bool Util::FromStrToAny(const std::string & str, T & out )
{
std::istringstream iss( str ); 
// tenter output
return iss >> out != 0;
}
 
void Util::Ecrire(const std::string& text, const char* filename) 
{
std::ofstream myfile;
myfile.open(filename, std::ios::out | std::ios::app );
myfile << text << "\n";
myfile.close();
}

C'est certainement pas mes include qui se croisent car les autres fonctions sont OK....

Une idée?