RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 1567 | Replies: 4 | Solved
Join Date: Oct 2006
Location: Manchester, UK
Posts: 3
Reputation: delphi_uk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
delphi_uk delphi_uk is offline Offline
Newbie Poster

Unresolved External Symbol Error

  #1  
Mar 15th, 2007
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> > > > &)"

  1. // stringtest.cpp
  2.  
  3. #include <string>
  4. #include <algorithm>
  5. #include <vector>
  6. #include <iostream>
  7. #include <fstream>
  8.  
  9. using namespace std;
  10.  
  11. void Tokenize(const string& str, vector<string>& tokens);
  12.  
  13. int main()
  14. {
  15. vector<string> tokens;
  16.  
  17. char _string[256];
  18. char inputChar[256];
  19. string inputString;
  20. ifstream input;
  21.  
  22. cout << "Enter name of an existing file: ";
  23. cin.get( _string, 256 );
  24.  
  25. input.open( _string );
  26.  
  27. input.getline( inputChar, 256 );
  28. cout << inputChar << endl;
  29. inputString = inputChar;
  30. cout << inputString << endl << endl;
  31.  
  32. Tokenize( inputString, token );
  33. copy( tokens.begin(), tokens.end(), ostream_iterator<string>(cout, ", "));
  34.  
  35. return 0;
  36. }
  37.  
  38. void Tokenize( const string& str, vector<string>& tokens, const string& delimiters = "|")
  39. {
  40. // Tokenize taken from [url]http://www.hispafuentes.com/[/url]
  41. // Skip delimiters at the beginning
  42. string::size_type lastPos = str.find_first_not_of( delimeters, 0 );
  43. // Find first "non-delimiter".
  44. string::size_type pos = str.find_first_of( delimiters, lastPos );
  45.  
  46. while (string::npos != pos || string::npos != lastPos)
  47. {
  48. // Found a token add it to the vector
  49. tokens.push_back( str.substr(lastPos, pos - lastPos));
  50. // Skip delimiters. Note the "not_of"
  51. lastPos = str.find_first_not_of( delimiters, pos);
  52. // Find next "non-delimiter"
  53. pos = str.find_first_of( delimiters, lastPos );
  54. }
  55. }

Thank you very much in advance,

Delphi
Last edited by delphi_uk : Mar 15th, 2007 at 7:50 pm.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:45 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC