Namespace trouble

Hello ya'll, I hope someone can answer this, or atleast point me in the right direction. I've finished a program for my CS class and it worked perfect. Then I remembered we have to create out own namespace and include out class/functions in it, when I do that. I get two errors that I cannot find anywhere.
*********************************************************************
1>Source.obj : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl fraction::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class fraction::rational)" (??6fraction@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@Vrational@0@@Z) referenced in function _main
**************************************************************************
this horrible thing is all one error. There is another one referring to the istream. This is my header file. Any input would be MUCH appreaciated
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
 #ifndef RATIONAL_H
#define RATIONAL_H

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::ostream;
using std::istream;
using std::ofstream;
using std::numeric_limits;
using std::streamsize;
using std::min;

namespace fraction
{


	class rational
	{

	private:
		int *numerator, *denominator;

	public:
		rational();
		rational(int, int);
		rational(int);
		rational(rational &);

		int GetNumerator() const;
		int GetDenominator() const;
		void SetNumerator(const int);
		void SetDenominator(const int);

		rational operator + (const rational &);
		rational operator - (const rational &);
		rational operator * (const rational&);
		rational operator / (const rational &);
		bool operator == (const rational &);
		bool operator < (const rational &);
		bool operator > (const rational &);
		bool operator <= (const rational &);
		bool operator >= (const rational &);

		friend ostream& operator << (ostream& os, rational fraction);
		friend istream& operator >> (istream& is, rational& fraction);

		void reduce()const;
		static bool validate(string s);
		static int gcd(int, int);
		static int lcm(const int, const int);

	};

}

#endif 
The functions declared on lines 51 and 52 also have to be in the fraction namespace - go find where they are defined.

By the way, that's not how you pronounce (or spell) y'all ;)
Last edited on
Thank you for the help, I got it workin' now. By the way we get no good book learnin' in the south. I'll start with "Good day my fellow bloaks" next time :D
chickens7 wrote:
By the way we get no good book learnin' in the south.
I think my Texas south and your south are different souths, haha.
Topic archived. No new replies allowed.