Trying to track down a LNK2019 Unresolved External Symbol error on a function that has a number of std::string const & arguments.
Step one of this answer says to check decorated / undecorated names, and this is what I’m seeing in the linker error text in the argument list:
class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &
Is this also std::string const & ?
Thanks for your help.
I’m running VS 2008.
Yes.
As part of the C++ standardization, the
std::stringclass was made more STL-compatible. Like the STL containers, the element type can be chosen. Common choices arecharandwchar_t, but Visual C++ users can also useTCHAR. Like STL containers, memory allocation is handled by an allocator.However, strings are unlike other containers because some methods need to perform more complex operations on their elements.
std::set<T>only needs to compare twoTobjects, butstd::stringneeds to deal with multi-byte encodings and such complications. These details are wrapped up in classstd::char_traits<char>.So, with all this complexity, you end up with
std::basic_string<char, std::char_traits<char>, std::allocator<char> >. That’s of course not very friendly, and most people just need the defaults.std::stringis the friendly name for that.