so im writing a lexer and i want to be able to pass it one of the following to the constructor:
1) vector<vector<string>> for the contents of multiple files
2) vector<string> for one file
3) string[][] see 1
4) string[] see 2
5) string so that i can run a test or make it inline c++ or something like that. ie:
Lexer Lex("Here is my jade script");
and then the constructor determines the type and sends it to be converted back to one string. the only problem is i get this error:
dtscode@dtscode-Latitude-E6410:~/Desktop/compiler$ ../gcc*/bin/g++ -std=c++11 main.cpp Lexer.cpp -o jade
/tmp/ccrEM7FN.o: In function `main':
main.cpp:(.text+0x1be): undefined reference to `Lexer::Lexer<std::vector<std::string, std::allocator<std::string> > >(std::vector<std::string, std::allocator<std::string> >)'
collect2: error: ld returned 1 exit status
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include "Token.hpp"
#include "Lexer.hpp"
using std:: ostream;
using std:: cout;
using std:: cerr;
using std:: endl;
using std:: cin;
using std:: ifstream;
using std::istringstream;
using std:: string;
using std:: vector;
void Log(int Line)
{
staticint Current = 1;
cout<<"Log ("<< Current++ <<") @ Line: "<< Line << endl;
}
constexprunsignedint Str2Int(constchar *Line, int CurrentPos = 0)
{
return !Line[CurrentPos] ? 5381 : (Str2Int(Line, CurrentPos + 1) * 33) ^ Line[CurrentPos];
}
void Help ();
void Version ();
void About ();
int main(int argc, char *argv[])
{
vector<string> Arguments(argv + 1, argv + argc);
vector<string> FileList;
for(auto &Counter : Arguments)
{
switch(Str2Int(Counter.c_str()))
{
case Str2Int("--help"):
Help();
break;
case Str2Int("--version"):
Version();
break;
case Str2Int("--about"):
About();
break;
default:
FileList.push_back(Counter);
}
}
ifstream File;
Lexer Lex(FileList);
}
void Help()
{
}
void Version()
{
}
void About()
{
}
(i know main() looks a little weird but thats because i decided to change it to classes instead of functions and decided to implement it first before cleaning it up)