V
vector
I am trying with little success to create a .NET class library using
Visual C++ .NET 2003. My project will use STL. I can add to my
solution without trouble a C# test application which calls into my C++
library.
When I merely add the line "#include <vector>" to my main DLL file in
the C++ project, 25 build errors appear. If I add a line
"std::vector<int> integers;" to a function in the project, even
without using that vector, the error count is reduced to 3.
I can use STL vectors in managed C++ console application projects
without these difficulties. I suspect a project setting to be wrong,
but can't seem to isolate it.
Can someone please offer advice on how to correct these problems?
--- the 3 errors ---
error LNK2020: unresolved token (0A00000B) exception.__ctor
error LNK2020: unresolved token (0A00000C) ??_7type_info@@6B@
error LNK2020: unresolved token (0A000016) exception.__dtor
fatal error LNK1120: 3 unresolved externals
--- the 25 errors ---
error LNK2001: unresolved external symbol "const type_info::`vftable'"
(??_7type_info@@6B@)
error LNK2001: unresolved external symbol "const type_info::`vftable'"
(??_7type_info@@6B@)
error LNK2001: unresolved external symbol "int __cdecl
__CxxDetectRethrow(void *)" (?__CxxDetectRethrow@@$$J0YAHPAX@Z)
error LNK2001: unresolved external symbol "int __cdecl
__CxxExceptionFilter(void *,void *,int,void *)"
(?__CxxExceptionFilter@@$$J0YAHPAX0H0@Z)
error LNK2001: unresolved external symbol "int __cdecl
__CxxQueryExceptionSize(void)" (?__CxxQueryExceptionSize@@$$J0YAHXZ)
error LNK2001: unresolved external symbol "int __cdecl
__CxxRegisterExceptionObject(void *,void *)"
(?__CxxRegisterExceptionObject@@$$J0YAHPAX0@Z)
error LNK2001: unresolved external symbol "public: __thiscall
exception::exception(class exception const &)"
(??0exception@@QAE@ABV0@@Z)
error LNK2001: unresolved external symbol "public: __thiscall
exception::exception(class exception const &)"
(??0exception@@QAE@ABV0@@Z)
error LNK2001: unresolved external symbol "public: virtual __thiscall
exception::~exception(void)" (??1exception@@UAE@XZ)
error LNK2001: unresolved external symbol "public: virtual char const
* __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
error LNK2001: unresolved external symbol "void * __cdecl memcpy(void
*,void const *,unsigned int)" (?memcpy@@$$J0YAPAXPAXPBXI@Z)
error LNK2001: unresolved external symbol "void * __cdecl memmove(void
*,void const *,unsigned int)" (?memmove@@$$J0YAPAXPAXPBXI@Z)
error LNK2001: unresolved external symbol "void __cdecl
__CxxUnregisterExceptionObject(void *,int)"
(?__CxxUnregisterExceptionObject@@$$J0YAXPAXH@Z)
error LNK2001: unresolved external symbol "void __cdecl operator
delete(void *)" (??3@$$FYAXPAX@Z)
error LNK2001: unresolved external symbol "void __stdcall
_CxxThrowException(void *,struct _s__ThrowInfo const *)"
(?_CxxThrowException@@$$J18YGXPAXPBU_s__ThrowInfo@@@Z)
error LNK2001: unresolved external symbol __load_config_used
error LNK2019: unresolved external symbol "public: __thiscall
exception::exception(char const * const &)"
(??0exception@@QAE@ABQBD@Z) referenced in function "public: __thiscall
std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
error LNK2019: unresolved external symbol "public: __thiscall
exception::exception(void)" (??0exception@@QAE@XZ) referenced in
function "public: __thiscall std::logic_error::logic_error(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
error LNK2019: unresolved external symbol "public: virtual __thiscall
exception::~exception(void)" (??1exception@@UAE@XZ) referenced in
function $L12220
error LNK2019: unresolved external symbol ___CxxFrameHandler
referenced in function __ehhandler$?_Xlen@_String_base@std@@QBEXXZ
error LNK2019: unresolved external symbol __callnewh referenced in
function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
error LNK2019: unresolved external symbol __except_list referenced in
function "public: void __thiscall std::_String_base::_Xlen(void)const
" (?_Xlen@_String_base@std@@QBEXXZ)
error LNK2019: unresolved external symbol _atexit referenced in
function "void __cdecl std::_Nomemory(void)" (?_Nomemory@std@@YAXXZ)
error LNK2019: unresolved external symbol _malloc referenced in
function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
error LNK2019: unresolved external symbol _strlen referenced in
function "public: static unsigned int __cdecl
std::char_traits<char>::length(char const *)"
(?length@?$char_traits@D@std@@SAIPBD@Z)
Visual C++ .NET 2003. My project will use STL. I can add to my
solution without trouble a C# test application which calls into my C++
library.
When I merely add the line "#include <vector>" to my main DLL file in
the C++ project, 25 build errors appear. If I add a line
"std::vector<int> integers;" to a function in the project, even
without using that vector, the error count is reduced to 3.
I can use STL vectors in managed C++ console application projects
without these difficulties. I suspect a project setting to be wrong,
but can't seem to isolate it.
Can someone please offer advice on how to correct these problems?
--- the 3 errors ---
error LNK2020: unresolved token (0A00000B) exception.__ctor
error LNK2020: unresolved token (0A00000C) ??_7type_info@@6B@
error LNK2020: unresolved token (0A000016) exception.__dtor
fatal error LNK1120: 3 unresolved externals
--- the 25 errors ---
error LNK2001: unresolved external symbol "const type_info::`vftable'"
(??_7type_info@@6B@)
error LNK2001: unresolved external symbol "const type_info::`vftable'"
(??_7type_info@@6B@)
error LNK2001: unresolved external symbol "int __cdecl
__CxxDetectRethrow(void *)" (?__CxxDetectRethrow@@$$J0YAHPAX@Z)
error LNK2001: unresolved external symbol "int __cdecl
__CxxExceptionFilter(void *,void *,int,void *)"
(?__CxxExceptionFilter@@$$J0YAHPAX0H0@Z)
error LNK2001: unresolved external symbol "int __cdecl
__CxxQueryExceptionSize(void)" (?__CxxQueryExceptionSize@@$$J0YAHXZ)
error LNK2001: unresolved external symbol "int __cdecl
__CxxRegisterExceptionObject(void *,void *)"
(?__CxxRegisterExceptionObject@@$$J0YAHPAX0@Z)
error LNK2001: unresolved external symbol "public: __thiscall
exception::exception(class exception const &)"
(??0exception@@QAE@ABV0@@Z)
error LNK2001: unresolved external symbol "public: __thiscall
exception::exception(class exception const &)"
(??0exception@@QAE@ABV0@@Z)
error LNK2001: unresolved external symbol "public: virtual __thiscall
exception::~exception(void)" (??1exception@@UAE@XZ)
error LNK2001: unresolved external symbol "public: virtual char const
* __thiscall exception::what(void)const " (?what@exception@@UBEPBDXZ)
error LNK2001: unresolved external symbol "void * __cdecl memcpy(void
*,void const *,unsigned int)" (?memcpy@@$$J0YAPAXPAXPBXI@Z)
error LNK2001: unresolved external symbol "void * __cdecl memmove(void
*,void const *,unsigned int)" (?memmove@@$$J0YAPAXPAXPBXI@Z)
error LNK2001: unresolved external symbol "void __cdecl
__CxxUnregisterExceptionObject(void *,int)"
(?__CxxUnregisterExceptionObject@@$$J0YAXPAXH@Z)
error LNK2001: unresolved external symbol "void __cdecl operator
delete(void *)" (??3@$$FYAXPAX@Z)
error LNK2001: unresolved external symbol "void __stdcall
_CxxThrowException(void *,struct _s__ThrowInfo const *)"
(?_CxxThrowException@@$$J18YGXPAXPBU_s__ThrowInfo@@@Z)
error LNK2001: unresolved external symbol __load_config_used
error LNK2019: unresolved external symbol "public: __thiscall
exception::exception(char const * const &)"
(??0exception@@QAE@ABQBD@Z) referenced in function "public: __thiscall
std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z)
error LNK2019: unresolved external symbol "public: __thiscall
exception::exception(void)" (??0exception@@QAE@XZ) referenced in
function "public: __thiscall std::logic_error::logic_error(class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > const &)"
(??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z)
error LNK2019: unresolved external symbol "public: virtual __thiscall
exception::~exception(void)" (??1exception@@UAE@XZ) referenced in
function $L12220
error LNK2019: unresolved external symbol ___CxxFrameHandler
referenced in function __ehhandler$?_Xlen@_String_base@std@@QBEXXZ
error LNK2019: unresolved external symbol __callnewh referenced in
function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
error LNK2019: unresolved external symbol __except_list referenced in
function "public: void __thiscall std::_String_base::_Xlen(void)const
" (?_Xlen@_String_base@std@@QBEXXZ)
error LNK2019: unresolved external symbol _atexit referenced in
function "void __cdecl std::_Nomemory(void)" (?_Nomemory@std@@YAXXZ)
error LNK2019: unresolved external symbol _malloc referenced in
function "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
error LNK2019: unresolved external symbol _strlen referenced in
function "public: static unsigned int __cdecl
std::char_traits<char>::length(char const *)"
(?length@?$char_traits@D@std@@SAIPBD@Z)