I don't know what it means:

class Tree{
	friend ostream& operator<<(ostream&, const Tree&);
private:
	TreeNode *Root;
	void insert(TreeNode*&,int);
	void PrintInOrder(TreeNode*);
	int Median(int[],int&);
public:
	Tree();
	Tree(int);
	void insa(int[]);
	void ins(int);
	void print();
};

ostream& operator<<(ostream& out, const Tree& tree){
	out << tree.Root ->GiveValue(tree.Root);
	return out;
} 

Tree::Tree (){
	Root = 0;
}

Tree::Tree(int i){
	Root = new TreeNode(i);
}

void Tree::insa(int i[]){
int R,c,temp;
c= Median(i,R);
temp=i[0];
i[0]=c;
i[R]=temp;
for(int ii=0;ii<iSize;ii++){
	insert(Root,i[ii]);	
}
}

int Median(int i[],int& R){
	int j,m=0,M=0,s,C = 0;
	s=(sizeof(i)/sizeof(int));
	for (int ii = 0; ii<s ;ii++){
		for (j =0; j<s;j++){
			if(i[ii]<i[j])
				m++;
			if(i[ii]<i[j])
				M++;}
		if(m==M){
			R=ii;
			C=i[ii];
			return C;}
	}
	return 0;
}

insa(i) is called by main, where i[] is declared with 1,2,3,4,5,6,7
iSize is 7, const int.
Why do I get this error:

Error	1	error LNK2028: unresolved token (0A0002B3) "private: int __thiscall Tree::Median(int * const,int &)" (?Median@Tree@@$$FAAEHQAHAAH@Z) referenced in function "public: void __thiscall Tree::insa(int * const)" (?insa@Tree@@$$FQAEXQAH@Z)	Alberi binari.obj	Alberi binari
Error	2	error LNK2019: unresolved external symbol "private: int __thiscall Tree::Median(int * const,int &)" (?Median@Tree@@$$FAAEHQAHAAH@Z) referenced in function "public: void __thiscall Tree::insa(int * const)" (?insa@Tree@@$$FQAEXQAH@Z)	Alberi binari.obj	Alberi binari

Thank you if you answer, and please give a look to the NetBeans thread, I really need that too.

line 40 is wrong -- as posted it is just a simple global function, which is unrelated to the Tree class. You need to add Treed:: before the function name, similar to what you did on line 29.

Oh Jesus, thanks! How could I miss it... Could VC++ just tell me?!? Thank you so much!

That was such a strange way to do it... I love the way it reports errors, like
(maybe you forgot to add ; after the class?)
This error report simply scared me, anyway thank you, thumb up!

Edited 5 Years Ago by HeartBalloon: n/a

This question has already been answered. Start a new discussion instead.