I'm writing a code for my classes and have an error I can't deal with. The errors are as follow. Also I'm not allowed to change anything in the main file:
In file included from lab13.cpp:15:0:
lab13.h: In member function ‘TSeries& TSeries::operator()(int, int)’:
lab13.h:10:39: warning: no return statement in function returning non-void [-Wreturn-type]
TSeries &operator()(int, int){}
^
g++ -c -Wall lab13f.cpp
In file included from lab13f.cpp:1:0:
lab13.h:15:10: error: ‘ostream’ in namespace ‘std’ does not name a type
friend std::ostream &operator<<(std::ostream &o,const TSeries &ts);
^
lab13.h: In member function ‘TSeries& TSeries::operator()(int, int)’:
lab13.h:10:39: warning: no return statement in function returning non-void [-Wreturn-type]
TSeries &operator()(int, int){}
^
lab13f.cpp: At global scope:
lab13f.cpp:13:9: error: prototype for ‘TSeries TSeries::operator()(int, int)’ does not match any in class ‘TSeries’
TSeries TSeries::operator()(int, int){}
^
In file included from lab13f.cpp:1:0:
lab13.h:10:18: error: candidate is: TSeries& TSeries::operator()(int, int)
TSeries &operator()(int, int){}
^
lab13f.cpp:16:9: error: prototype for ‘TSeries TSeries::operator+(TSeries&)’ does not match any in class ‘TSeries’
TSeries TSeries::operator+(TSeries &ts){
^
In file included from lab13f.cpp:1:0:
lab13.h:9:17: error: candidate is: const TSeries TSeries::operator+(const TSeries&) const
const TSeries operator+(const TSeries &ts)const;
^
lab13f.cpp:45:19: error: definition of implicitly-declared ‘TSeries::~TSeries()’
TSeries::~TSeries(){}
^
lab13f.cpp: In member function ‘TSeries& TSeries::operator=(TSeries (*)(int, int))’:
lab13f.cpp:47:52: warning: no return statement in function returning non-void [-Wreturn-type]
TSeries &TSeries::operator=(TSeries(int a, int b)){}
^
lab13f.cpp: In function ‘std::ostream& operator<<(std::ostream&, const TSeries&)’:
lab13f.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [lab13f.o] Błąd 1
I've spend a couple of days trying to solve the issue and gave up finally. Hopefull somebody will help me with my struggle :) I'd be most grateful.
I've forgrotten to add that the main file was written by the tutor and under no ccircumstances I'm not allowed to change ANYTHING in it.
The compiler is complaining because series1(2,4) invokes TSeries::operator()(int, int), which is missing, and not the constructor TSeries(int, int)