Srin50
July 15th, 2002, 11:25 AM
I'm simply trying to declare and initialize a std::string
variable and I get the following Link error:
error LNK2019: unresolved external symbol "public: void
__thiscall std::_String_base::_Xran(void)const " (?
_Xran@_String_base@std@@QBEXXZ) referenced in
function "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &
__thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::assign
(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const
&,unsigned int,unsigned int)" (?assign@?$basic_string@DU?
$char_traits@D@std@@V?
$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
All I'm trying is the following:
#include <string>
using namespace std;
int main()
{
string s1("test");
return 0;
}
It compiles fine but gives the Link error above.
This is the first time I'm using STL in VC7 (Visual
Studio.NET).
It appears that the class basic_string< > is derived from
a class _String_base in the header <xstring>. The class
_String_base declares 2 methods: _Xlen() and _Xran() to
hold lenght and range error reporters. It is these two
methods which are generating the link errors.
I think the class _String_base is declared as
a 'dllimport' class (macro _CRTIMP2), butif that's the
case, I'm not sure which DLL it's defined in.
Any help on this is appreciated.
Thanks
Srinivas
variable and I get the following Link error:
error LNK2019: unresolved external symbol "public: void
__thiscall std::_String_base::_Xran(void)const " (?
_Xran@_String_base@std@@QBEXXZ) referenced in
function "public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > &
__thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::assign
(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const
&,unsigned int,unsigned int)" (?assign@?$basic_string@DU?
$char_traits@D@std@@V?
$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
All I'm trying is the following:
#include <string>
using namespace std;
int main()
{
string s1("test");
return 0;
}
It compiles fine but gives the Link error above.
This is the first time I'm using STL in VC7 (Visual
Studio.NET).
It appears that the class basic_string< > is derived from
a class _String_base in the header <xstring>. The class
_String_base declares 2 methods: _Xlen() and _Xran() to
hold lenght and range error reporters. It is these two
methods which are generating the link errors.
I think the class _String_base is declared as
a 'dllimport' class (macro _CRTIMP2), butif that's the
case, I'm not sure which DLL it's defined in.
Any help on this is appreciated.
Thanks
Srinivas