Well, I've been working on a simple explorer.exe replacement, with it's own simple scripting language.
Everything was going fine until I added a ParseScript, and tokenizeString Function:
Code:
PUNCH error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl punch::tokenizeString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,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> > > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?tokenizeString@punch@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@0@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl punchScript::ParseScript(class punchScript::scriptObject)" (?ParseScript@punchScript@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VscriptObject@1@@Z)
Now, from what I can gather, the error is related to the ParseScript function. Here's that and the tokenizeString one (Based on the one from the FAQ):
ParseScript:
Code:
string punchScript::ParseScript(scriptObject script)
{
vector < string > commands;
punch::tokenizeString(script.commands, commands, "\n");
for(int i=0; i < (int)commands.size(); i++)
{
if(commands[i].find("createWindow ", 0) == 0)
{
string file = commands[i].erase(0, 12); //File for that command
char* buff = "";
sprintf(buff, "%s", file.c_str());
ShellExecute(NULL, "open", buff, NULL, NULL, SW_SHOWNORMAL);
}
if(commands[i].find("script ", 0) == 0)
{
string file = commands[i].erase(0, 6); //File for that command
scriptObject obj = LoadScript(file);
return ParseScript(obj);
}
}
return "TRUE";
}
tokenizeString:
Code:
string tokenizeString(string str1, vector<string> target, string delimeter="\n")
{
string str = str1;
vector <string> tokens; //we'll put all of the tokens in here
string temp;
while (str.find(delimeter, 0) != string::npos)
{
size_t pos = str.find(delimeter, 0); //store the position of the delimiter
temp = str.substr(0, pos); //get the token
str.erase(0, pos + 1); //erase it from the source
tokens.push_back(temp); //and put it into the array
}
tokens.push_back(str); //the last token is all alone
target = tokens;
return "TRUE";
}
Sorry for the overly-long post