From: Victor Bazarov on
Brian Muth wrote:
> To add to the other replies, you can also use the /MT compiler switch to
> indicate that you want to statically link to your libraries. This will
> incorporate the runtime library code directly into your application so you
> don't have any dependencies at all.

I think that's only true if he doesn't use any third-party static
libraries that were compiled with /MD or some such, or third-party
dynamic libraries.

V
From: John Carson on
<bob(a)coolgroups.com> wrote in message
news:1138218177.172533.61590(a)g47g2000cwa.googlegroups.com
> When I use the /MT compiler switch, I get a lot of errors:
>
> Linking...
> comdemo.obj : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::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> > const &)"
> (??0?$basic_string(a)DU?$char_traits@D(a)std@@V?$allocator@D@2@@std@@QAE(a)ABV01@@Z)
> already defined in msvcprtd.lib(MSVCP80D.dll)
> comdemo.obj : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::~basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(void)"
> (??1?$basic_string(a)DU?$char_traits@D(a)std@@V?$allocator@D@2@@std@@QAE(a)XZ)
> already defined in msvcprtd.lib(MSVCP80D.dll)
> comdemo.obj : error LNK2005: "public: char const * __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::c_str(void)const "
> (?c_str@?$basic_string(a)DU?$char_traits@D(a)std@@V?$allocator@D@2@@std@@QBEPBDXZ)
> already defined in msvcprtd.lib(MSVCP80D.dll)
> comdemo.obj : error LNK2005: "public: __thiscall
> std::_Container_base::~_Container_base(void)"
> (??1_Container_base(a)std@@QAE(a)XZ) already defined in
> msvcprtd.lib(MSVCP80D.dll)
> comdemo.obj : error LNK2005: "public: __thiscall
> std::_Container_base::_Container_base(void)"
> (??0_Container_base(a)std@@QAE(a)XZ) already defined in
> msvcprtd.lib(MSVCP80D.dll)
> comdemo.obj : error LNK2005: "public: __thiscall
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >(char const *)"
> (??0?$basic_string(a)DU?$char_traits@D(a)std@@V?$allocator@D@2@@std@@QAE(a)PBD@Z)
> already defined in msvcprtd.lib(MSVCP80D.dll)
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:library
> comdemo.obj : error LNK2019: unresolved external symbol
> __CrtDbgReportW referenced in function "wchar_t * __cdecl
> A2WBSTR(char const *,int)" (?A2WBSTR@@YAPA_WPBDH@Z)
> libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol
> __CrtDbgReportW
> libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
> __malloc_dbg referenced in function "void * __cdecl operator
> new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)"
> (??2(a)YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
> libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
> __free_dbg referenced in function "void __cdecl operator delete(void
> *,struct std::_DebugHeapTag_t const &,char *,int)"
> (??3(a)YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)


Try doing a Rebuild Solution. That should get rid of at least some of the
errors.


--
John Carson




From: bob on
"Rebuild Solution" did get rid of some of them, but these are still
there:

LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other
libs; use /NODEFAULTLIB:library
comdemo.obj : error LNK2019: unresolved external symbol __CrtDbgReportW
referenced in function "wchar_t * __cdecl A2WBSTR(char const *,int)"
(?A2WBSTR@@YAPA_WPBDH@Z)
libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol
__CrtDbgReportW
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
__malloc_dbg referenced in function "void * __cdecl operator
new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)"
(??2(a)YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
__free_dbg referenced in function "void __cdecl operator delete(void
*,struct std::_DebugHeapTag_t const &,char *,int)"
(??3(a)YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)

From: John Carson on
<bob(a)coolgroups.com> wrote in message
news:1138250145.677320.130090(a)g43g2000cwa.googlegroups.com
> "Rebuild Solution" did get rid of some of them, but these are still
> there:
>
> LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
> other libs; use /NODEFAULTLIB:library
> comdemo.obj : error LNK2019: unresolved external symbol
> __CrtDbgReportW referenced in function "wchar_t * __cdecl
> A2WBSTR(char const *,int)" (?A2WBSTR@@YAPA_WPBDH@Z)
> libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol
> __CrtDbgReportW
> libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
> __malloc_dbg referenced in function "void * __cdecl operator
> new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)"
> (??2(a)YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
> libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol
> __free_dbg referenced in function "void __cdecl operator delete(void
> *,struct std::_DebugHeapTag_t const &,char *,int)"
> (??3(a)YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)


Wild guess: are you using /MT in debug mode? You should use /MTd for debug
mode and /MT for release mode.

--
John Carson


First  |  Prev  | 
Pages: 1 2
Prev: Question about Deprecated Functions
Next: xp error