Hi, I'm having trouble executing the following line of code:
Tokeniser tokeniser(cin);
The compiler complains thats i have a undefined reference to Tokeniser::Tokeniser(std::basic_istream(char, std::char_traits(char))&)
The line Test tester(cin) works as since it was written by myself.
However, whenever i try executing Tokeniser tokeniser(cin) i get the compilation error.
I am given Tokeniser.h with various other header files and a libparser.a as part of the assignment
My makefile includes:
//START OF MAKE FILE
HEADER_PATH = ass3/parser/
LIB_PATH = ass3/parser/
LIB_NAME = parser
search.exe: main.o test.o
g++ -g -Wall -o search.exe main.o test.o -L$(LIB_PATH) -l$(LIB_NAME) -static
rm main.o
rm test.o
main.o: main.cc
g++ -c -O -Wall -I$(HEADER_PATH) main.cc
test.o: test.cc
g++ -c -O -Wall test.cc
// END OF MAKEFILE
//main.cc start
#include <iostream>
#include "Tokeniser.h"
#include "Test.h"
using namespace std;
int main(){
//Test tester(cin); //this line works
Tokeniser tokeniser(cin);
return 0;
}
//main.cc end
//parts of tokeniser header file given
class Tokeniser {
// Since our queries are short, internally the Tokeniser pretokenises
// the whole stream. In other situations this may not be wise.
std::vector<std::string> tokens;
std::vector<std::string>::iterator tokenIndex;
public:
// This is not a Singleton because each tokeniser wraps an istream
// and must have its own state: the number of tokens consumed so far
Tokeniser(std::istream&);
// Routines to peek ahead at and extract tokens
std::pair<Token, std::string> lookahead(bool phrase = false);
std::pair<Token, std::string> next(bool phrase = false);
// Defining this means we can use constructs like 'while (tokeniser)'
// It is defined to return NULL (effectively false) when there are
// no tokens left and this otherwise.
operator void *();
};
Thank you in advance