Bonjour

J'ai défini un singleton (une classe Utility). Je pense que je merde sur les appels des includes de Utility.h : J'ai un include dans mon Main.pp, mais quand j'en fais un autre dans un cpp j'ai une erreur
définition multiple de " afp::Utility::instance "
Voici mon singleton :
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
 
#ifndef __UTILITY_H_
#define __UTILITY_H_
 
namespace afp {
 
 
class Utility {
 
 
public:
	static Utility* getInstance() {
		if (Utility::instance == 0) {
			Utility::instance = new Utility();
		}
		return Utility::instance;
	}
	static void kill(){
		if (Utility::instance == 0) {
			delete Utility::instance;
		}
	}
 
	bool isShowPerf() {
		return this->showPerf;
	}
	void setShowPerf(bool b) {
		this->showPerf = b;
	}
 
	bool isShowDebug() {
		return this->showDebug;
	}
	void setShowDebug(bool b) {
		this->showDebug = b;
	}
 
private:
 
	bool showPerf;
	bool showDebug;
	static Utility* instance;
};
Utility *Utility::instance = 0;
}  // namespace afp
 
#endif /* UTILITY_H_ */
Je ne vois pas trop ce qui cloche
Est ce quelqu'un a une idée?

Merci d'avance