Salut, je m'araches les cheveux depuis 1 heures. Je fais appel a votre experience avant de lacher cette solution et de passer à une implementation 100% objet.

Voila, j'implemente une classe dont le fonctionnement repose sur une combinaison de struct et de pointeur.

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
56
57
58
59
60
61
#ifndef LOGGER_H_
#define LOGGER_H_
 
#include <string>
#include <GL/glfw.h>
 
 
class Logger {
 
public:
	static const int DEBUG;
	static const int NORMAL;
	static const int IMPORTANT;
 
	static Logger * getSingleton ();
	~Logger();
 
	int log (std::string);
	int log (int, std::string);
	int log (int, std::string, std::string);
 
	int setDirectory (std::string);
	int setFilenameText (std::string);
	int setPrefixBMP (std::string);
 
private:
	Logger();
 
	static Logger * ptr;
	GLFWmutex loggerMutex;
 
	std::string directory;
	std::string filenameText;
	std::string prefixBMP;
 
	static const int nbEntrees;
	std::string lvlchar[3];
 
 
    // les structures en questions
 
	struct logData {
		int size;
		struct logEntry * entree[1000];
	};
 
	struct logEntry {
		//int type;
		int lvl;
		double date;
		std::string caller;
		std::string message;
	};
 
 
	struct logData * dataLogged, * dataWritten;
 
 
};
 
#endif /* LOGGER_H_ */
et la fonction log qui me rend fou

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
int Logger::log (int lvl, std::string caller, std::string msg) {
	struct logEntry * entree;
 
	glfwLockMutex (ptr->loggerMutex);
	if (dataLogged->size < nbEntrees) {
		entree = new struct logEntry;
		entree->lvl = lvl;
		entree->date = glfwGetTime ();
		entree->message = msg;
 
		dataLogged->entree[dataLogged->size] = entree; // C'est ici que ca coince
		glfwUnlockMutex (ptr->loggerMutex);
	}
	else {
		glfwUnlockMutex (ptr->loggerMutex);
		return -1;
	}
}
et voila l'erreur de compilation

logger.cpp: In member function `int Logger::log(int, std::string, std::string)':
logger.cpp:72: error: cannot convert `Logger::logEntry*' to `logEntry*' in assignment
mingw32-make.exe: *** [all] Error 1

Je comprend pas les types que mon compilateur me sort, pourquoi il refuse de me les caster et comment sortir de ce probleme.

Merci d'avoir preté attention a mon cas.