Hello to you all,
I am having problems with some code that I am working on for a text parsing system from an external *.txt file. The problem seems to stem from the Tokenize function, as I get a:
"LNK2019 error: unresolved external symbol "void __cdecl Tokenize(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<class std::basic_string<char,struct std::char_traits<char>, class std::allocator<char> >, class std::allocator<class std::basic_string<char, struct std::char_traits<char>,class std::allocator<char> > > > &)"
// stringtest.cpp
#include <string>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
void Tokenize(const string& str, vector<string>& tokens);
int main()
{
vector<string> tokens;
char _string[256];
char inputChar[256];
string inputString;
ifstream input;
cout << "Enter name of an existing file: ";
cin.get( _string, 256 );
input.open( _string );
input.getline( inputChar, 256 );
cout << inputChar << endl;
inputString = inputChar;
cout << inputString << endl << endl;
Tokenize( inputString, token );
copy( tokens.begin(), tokens.end(), ostream_iterator<string>(cout, ", "));
return 0;
}
void Tokenize( const string& str, vector<string>& tokens, const string& delimiters = "|")
{
// Tokenize taken from [URL]http://www.hispafuentes.com/[/URL]
// Skip delimiters at the beginning
string::size_type lastPos = str.find_first_not_of( delimeters, 0 );
// Find first "non-delimiter".
string::size_type pos = str.find_first_of( delimiters, lastPos );
while (string::npos != pos || string::npos != lastPos)
{
// Found a token add it to the vector
tokens.push_back( str.substr(lastPos, pos - lastPos));
// Skip delimiters. Note the "not_of"
lastPos = str.find_first_not_of( delimiters, pos);
// Find next "non-delimiter"
pos = str.find_first_of( delimiters, lastPos );
}
}
Thank you very much in advance,
Delphi