Problem when including header file

Hello,

I am currently working with graphics. I'm compiling using unix and xming for the output. I am supposed to create a window with different buttons, each button linked to an action. These actions are from another program; this program created a database of students each with their own grade, id and name which the program read from a file and it store them. the difference is that that did not use graphics.
An example of the actions would be:
Create a student. Search for a student.
Now, i am trying to combine the mentioned program with the one im creating and everything is ok until this point

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

#ifndef PROJECT_WINDOW_GUARD
#define PROJECT_WINDOW_GUARD 1

#include "GUI.h"
#include "Graph.h"

using namespace Graph_lib;

struct Project_window : Window {
	Project_window(Point xy, int w, int h, const string& title );
	
private:
	
	Button exit_button;
	Button load_button;		//Done
	Button add_button;		//Done	
	Button search_button;	//Done
	Button erase_button;	//Done
	Button display_button;	
	Button statistics_button;
	
	void exit();			
	void load();
	void add();
	void search();
	void erase();
	void output();
	void statistics();
	
	static void cb_exit(Address, Address);
	static void cb_load(Address, Address);
	static void cb_add(Address, Address);
	static void cb_search(Address, Address);
	static void cb_erase(Address, Address);
	static void cb_display(Address, Address);
	static void cb_statistics(Address, Address);
};

//--------------------------------------------------------------------------------------------------

struct Load_window : Window {
	Load_window(Point xy, int w, int h, const string& title );
	
private:
	
	In_box read;
	Button ok_button;
	Button cancel_button;
	
	void ok();
	void cancel();
	
	static void cb_ok(Address, Address);
	static void cb_cancel(Address, Address);
};

//--------------------------------------------------------------------------------------------------

struct Search_window : Window {
	Search_window(Point xy, int w, int h, const string& title );
	
private:
	
	In_box search;
	Out_box result;
	Button ok_button;
	Button cancel_button;
	
	void ok();
	void cancel();
	
	static void cb_ok(Address, Address);
	static void cb_cancel(Address, Address);
};

//---------------------------------------------------------------------------------------------------
struct Add_window : Window {
	Add_window(Point xy, int w, int h, const string& title );
	
private:
	
	In_box first_name;
	In_box last_name;
	Button ok_button;
	Button cancel_button;
	
	void ok();
	void cancel();
	
	static void cb_ok(Address, Address);
	static void cb_cancel(Address, Address);
};
//---------------------------------------------------------------------------------------------------
struct Display_window : Window {
	Display_window(Point xy, int w, int h, const string& title );
	
private:
	
	In_box choice;
	Out_box first_name;
	Out_box last_name;
	Button ok_button;
	Button cancel_button;
	
	void ok();
	void cancel();
	
	static void cb_ok(Address, Address);
	static void cb_cancel(Address, Address);
};
//---------------------------------------------------------------------------------------------------
struct Erase_window : Window {
	Erase_window(Point xy, int w, int h, const string& title );
	
private:
	
	In_box first_name;
	In_box last_name;
	Button ok_button;
	Button cancel_button;
	
	void ok();
	void cancel();
	
	static void cb_ok(Address, Address);
	static void cb_cancel(Address, Address);
};
//------------------------------------------------------------------------------
#endif


After that, when i just include a header file from the previous one(ex):

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
#ifndef _STUDENT_H_
#define _STUDENT_H_


#include "std_lib_facilities.h"

class Student{
	public:
	
	Student(){}
	Student(string f, string l, string i)
		:firstName(f), lastName(l), ID(i){}
	
	string get_ID(){return ID;};
	string get_lastName(){return lastName;};
	string get_firstName(){return firstName;};
	
	void display(){ cout << firstName<< " " <<lastName<< " " << ID << endl;};
	
	friend ostream & operator<<(ostream &stream, Student s);
	
	private:
	
	string firstName;
	string lastName;
	string ID;
	
};

ostream &operator<<(ostream &stream, Student s)
{
	stream << s.firstName << " ";
	stream << s.lastName<< " ";
	stream << s.ID << " " <<endl;

	return stream;	
}
#endif


It sends out an error saying numerous and different things for each one, for this one specifically it says:

/tmp/ccfB8Jv3.o(.text+0x0) In function 'operator<<(std::basic_ostream<char, std::char_traits<char> >&, Student)':
multiple definitions of 'operator<<(std::basic_ostream<char, std::char_traits<char> >&, Student)'
/tmp/ccfp3ZiY.o(.text+0x0): first defined here.

I dont know why it says that. Both the program that im working on and the program that contains this header file work correctly.

A help in this matter would be really appreciated!
Topic archived. No new replies allowed.