Been working on a program and well I wanna compile it. Before it because more of a bigger mess. Someone please help me or point me in the right direction of where to resolve my mistakes.
The errors
Rational.cpp:21:20: error: declaration of ‘Rational::Rational()’ outside of class is not definition [-fpermissive]
Rational::Rational();
^
Rational.cpp:22:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp: In copy constructor ‘Rational::Rational(const Rational&)’:
Rational.cpp:38:1: error: expected ‘;’ before ‘}’ token
}
^
Rational.cpp: In member function ‘Rational& Rational::operator=(const Rational&)’:
Rational.cpp:44:2: error: expected ‘;’ before ‘_q’
_q = r._q
^
Rational.cpp: In member function ‘Rational& Rational::operator-=(const Rational&)’:
Rational.cpp:59:20: error: passing ‘const Rational’ as ‘this’ argument of ‘Rational Rational::operator-()’ discards qualifiers [-fpermissive]
return operator+=(-r)
^
Rational.cpp:60:1: error: expected ‘;’ before ‘}’ token
}
^
Rational.cpp: At global scope:
Rational.cpp:98:50: error: declaration of ‘Rational Rational::operator+(const Rational&) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator+ (const Rational& r) const;
^
Rational.cpp:99:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:102:44: error: declaration of ‘Rational Rational::operator+(long long int) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator+ (long long L) const;
^
Rational.cpp:103:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:106:61: error: ‘Rational Rational::operator+(long long int, const Rational&)’ must take either zero or one argument
Rational Rational::operator+ (long long L, const Rational& r)
^
Rational.cpp:112:50: error: declaration of ‘Rational Rational::operator-(const Rational&) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator- (const Rational& r) const;
^
Rational.cpp:113:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:116:44: error: declaration of ‘Rational Rational::operator-(long long int) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator- (long long L) const;
^
Rational.cpp:117:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:120:61: error: ‘Rational Rational::operator-(long long int, const Rational&)’ must take either zero or one argument
Rational Rational::operator- (long long L, const Rational& r)
^
Rational.cpp:125:50: error: declaration of ‘Rational Rational::operator*(const Rational&) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator* (const Rational& r) const;
^
Rational.cpp:126:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:129:45: error: declaration of ‘Rational Rational::operator*(long long int) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator* (long long L ) const;
^
Rational.cpp:130:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:133:62: error: ‘Rational Rational::operator*(long long int, const Rational&)’ must take either zero or one argument
Rational Rational::operator* (long long L , const Rational& r)
^
Rational.cpp:138:50: error: declaration of ‘Rational Rational::operator/(const Rational&) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator/ (const Rational& r) const;
^
Rational.cpp:139:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:142:44: error: declaration of ‘Rational Rational::operator/(long long int) const’ outside of class is not definition [-fpermissive]
Rational Rational::operator/ (long long L) const;
^
Rational.cpp:143:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:146:62: error: ‘Rational Rational::operator/(long long int, const Rational&)’ must take exactly one argument
Rational Rational::operator/ (long long L , const Rational& r)
^
Rational.cpp:151:47: error: declaration of ‘bool Rational::operator==(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator== (const Rational& r) const; //2 implement this one
^
Rational.cpp:152:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:155:41: error: declaration of ‘bool Rational::operator==(long long int) const’ outside of class is not definition [-fpermissive]
bool Rational::operator== (long long L) const;
^
Rational.cpp:156:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:159:59: error: ‘bool Rational::operator==(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator== (long long L , const Rational& r)
^
Rational.cpp:164:47: error: declaration of ‘bool Rational::operator!=(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator!= (const Rational& r) const;
^
Rational.cpp:165:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:168:41: error: declaration of ‘bool Rational::operator!=(long long int) const’ outside of class is not definition [-fpermissive]
bool Rational::operator!= (long long L) const;
^
Rational.cpp:169:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:172:58: error: ‘bool Rational::operator!=(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator!= (long long L, const Rational& r)
^
Rational.cpp:177:46: error: declaration of ‘bool Rational::operator>(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator> (const Rational& r) const; // implement this one
^
Rational.cpp:178:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:182:40: error: declaration of ‘bool Rational::operator>(long long int) const’ outside of class is not definition [-fpermissive]
bool Rational::operator> (long long L) const;
^
Rational.cpp:183:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:186:58: error: ‘bool Rational::operator>(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator> (long long L , const Rational& r)
^
Rational.cpp:192:46: error: declaration of ‘bool Rational::operator<(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator< (const Rational& r) const;
^
Rational.cpp:193:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:196:40: error: declaration of ‘bool Rational::operator<(long long int) const’ outside of class is not definition [-fpermissive]
bool Rational::operator< (long long L) const;
^
Rational.cpp:197:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:200:57: error: ‘bool Rational::operator<(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator< (long long L, const Rational& r)
^
Rational.cpp:204:47: error: declaration of ‘bool Rational::operator>=(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator>= (const Rational& r) const;
^
Rational.cpp:205:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:208:41: error: declaration of ‘bool Rational::operator>=(long long int) const’ outside of class is not definition [-fpermissive]
bool Rational::operator>= (long long L) const;
^
Rational.cpp:209:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:212:58: error: ‘bool Rational::operator>=(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator>= (long long L, const Rational& r)
^
Rational.cpp:217:47: error: declaration of ‘bool Rational::operator<=(const Rational&) const’ outside of class is not definition [-fpermissive]
bool Rational::operator<= (const Rational& r) const;
^
Rational.cpp:218:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:221:6: error: prototype for ‘bool Rational::operator<=(long int) const’ does not match any in class ‘Rational’
bool Rational::operator<= (long L) const;
^
In file included from Rational.cpp:1:0:
Rational.h:68:6: error: candidates are: bool Rational::operator<=(long long int) const
bool operator <= (long long ) const;
^
Rational.cpp:217:6: error: bool Rational::operator<=(const Rational&) const
bool Rational::operator<= (const Rational& r) const;
^
Rational.cpp:222:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:225:58: error: ‘bool Rational::operator<=(long long int, const Rational&)’ must take exactly one argument
bool Rational::operator<= (long long L, const Rational& r)
^
Rational.cpp:252:31: error: declaration of ‘Rational Rational::operator-()’ outside of class is not definition [-fpermissive]
Rational Rational::operator -();
^
Rational.cpp:253:1: error: expected unqualified-id before ‘{’ token
{
^
Rational.cpp:256:31: error: declaration of ‘Rational Rational::operator+()’ outside of class is not definition [-fpermissive]
Rational Rational::operator +();
^
Rational.cpp:257:1: error: expected unqualified-id before ‘{’ token
{
^