bonjour,

voilà j'ai un petit problème avec operator<<.
Dans mon .h, il y ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
friend std::ostream& operator<< (std::ostream& ostr, const Operation& so);
Et dans mon .cpp, il y a ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
std::ostream& operator<< (std::ostream& ostr, const Operation& so)
{
	ostr << so.getType() << " : " <<  so.getMontant() << " le " << so.getDate();
	return ostr;
}
que je réutilise après comme ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
std::list<Operation>::iterator it = historique.begin();
int m;
for(m = it->getDate().getMois(); it->getDate().getMois() == m; it++)	
	str += "" << *it << std::endl;
Et à chaque fois que je fais make, il m'affiche ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
error: no match foroperator<<’ in ‘"" << * it’
Operation.h:21: note: candidates are: std::ostream& operator<<(std::ostream&, const Operation&)
Voici mon Makefile :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CC = g++
CCFLAGS = -ggdb3 -Wall -pedantic
ObjFiles = main.o Personne.o Adresse.o Date.o Societe.o CompteEnBanque.o Operation.o
 
all : main.out
 
%.o : %.cpp
	$(CC) $(CCFLAGS) -o $@ -c $<
 
main.out : $(ObjFiles)
	$(CC) -o $@ $^
 
clean:
	rm $(ObjFiles)
Donc la question, c'est : Qu'est-ce qui ne va pas dans mon operator<< ?

merci d'avance.