Putting data into a private object.

I am having trouble with putting my data into an object. Here is my code:

.h File:
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
#include<iostream>
#include<string>
#include "date.h"
#ifndef FRIEND_H 
#define FRIEND_H


class Friend{
    public:
	Friend();
	std::string get_name()const;
	Date get_bday()const;
	bool operator == (const Friend& other)const;
	bool operator != (const Friend& other)const;
	void input(std::istream& ins);
	void output(std::ostream& outs)const;
    private:
	std::string name;
	Date bday;
};

std::istream& operator >>(std::istream& ins,Friend& f);
std::ostream& operator <<(std::ostream& outs,const Friend& f);

#endif  


And my .cc
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
#include "date.h"
#include "friend.h"
#include<iostream>
#include<string>

using namespace std;

	Friend::Friend(){
		name = "No input";
		
	}
	std::string Friend::get_name()const{
		return name;
	}
	Date Friend::get_bday()const{
		return bday;
	} 

	//bool operator == (const Friend& other)const{}
	//bool operator != (const Friend& other)const{}
	void Friend::input(std::istream& ins){
		Friend another;
		
		int d,m,y;
		
		 if(&ins == &cin){
			cout << "Please enter the name of your friend: ";
			cin >> another.name; 
			cout << endl;
			
			cout << "Enter the birthday by day, month, year with a / inbetween: ";
			cin >> bday;
			
			
		 }
		 else{
			 //get from file
			 
		 }
	}
	//void output(std::ostream& outs)const{}
	//std::istream& operator >>(std::istream& ins,Friend& f){}
	//std::ostream& operator <<(std::ostream& outs,const Friend& f){} 


I am having trouble with "cin >> bday;" I am getting this error and don't know why:
ld: fatal: symbol 'main' is multiply-defined:
(file /var/tmp//ccanqWD5.o type=FUNC; file /var/tmp//ccu8cJDH.o type=FUNC);
ld: fatal: file processing errors. No output written to a.out

All I need to do is create a friend with a name and birth date separated by a "/". My date class which is not posted separates and tests to see if the date is valid or not. But I can't seem to even put a birth date in my code at the moment. Any pointers please?
That error says that the entry point to your program is defined in multiple files. After you confirm that this is not the case, you should try deleting the build files made by your compiler and clear your temp files. If that fails then create a new project and copy your source code over.
Isn't that what the macro guards protect? multiply defined files?
Files yes, but not functions.
Thank you computergeek, just created duplicate files with different file names and it compiled right away... I don't understand what happened exactly though. My compiler created duplicates and so the functions where multiply defined?
The compiler won't have created duplicates. In the code you were telling the compiler to compile, there were obviously two functions called main defined.
Topic archived. No new replies allowed.