Click here to Skip to main content
15,919,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: String Conversion C++ <--> VB Pin
ganralf18-Oct-08 3:12
ganralf18-Oct-08 3:12 
GeneralRe: String Conversion C++ <--> VB Pin
CPallini18-Oct-08 3:23
mveCPallini18-Oct-08 3:23 
GeneralRe: String Conversion C++ <--> VB Pin
ganralf18-Oct-08 3:30
ganralf18-Oct-08 3:30 
GeneralRe: String Conversion C++ <--> VB Pin
CPallini18-Oct-08 3:38
mveCPallini18-Oct-08 3:38 
AnswerRe: String Conversion C++ <--> VB Pin
Michael Dunn18-Oct-08 17:16
sitebuilderMichael Dunn18-Oct-08 17:16 
GeneralRe: String Conversion C++ <--> VB [modified] Pin
ganralf18-Oct-08 23:44
ganralf18-Oct-08 23:44 
QuestionAccessing Bits of Shared Memory Pin
Andy20218-Oct-08 0:52
Andy20218-Oct-08 0:52 
QuestionStatic linking not working Pin
scorpiodx18-Oct-08 0:27
scorpiodx18-Oct-08 0:27 
I wrote a small "Hello World" program that compiles and runs well on the machine I compiled it on (running Vista). The .exe file didn't run on a different XP machine however. I learned about vcredist_x86, but I wanted my program to run on just copying it without having to "prepare" the target machine. I decided to go for static compilation since the program I am working on (not the "Hello world", btw) is small and simple enough, and doesn't need the latest and greatest lib updates.

When I change the compiler code generation runtime library option to /MT and try to build, I get a bunch of errors -

>Linking...
1>hello.obj : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: static int __cdecl std::char_traits<char>::eof(void)" (?eof@?$char_traits@D@std@@SAHXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: int __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBEHXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: int __thiscall std::ios_base::width(int)" (?width@ios_base@std@@QAEHH@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: void __thiscall std::basic_ios<char,struct> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: class std::basic_streambuf<char,struct> > * __thiscall std::basic_ios<char,struct> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: class std::basic_ostream<char,struct> > & __thiscall std::basic_ostream<char,struct> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: class std::basic_ostream<char,struct> > * __thiscall std::basic_ios<char,struct> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct> >::_Lock(void)" (?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: void __thiscall std::basic_streambuf<char,struct> >::_Unlock(void)" (?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: char __thiscall std::basic_ios<char,struct> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in msvcprtd.lib(MSVCP90D.dll)
1>hello.obj : error LNK2005: "public: int __thiscall std::basic_streambuf<char,struct> >::sputn(char const *,int)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z) already defined in msvcprtd.lib(MSVCP90D.dll)
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(cout.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator<char,struct>,class std::allocator<char> >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>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@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>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@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype
1>C:\Users\Shankar\Documents\Visual Studio 2005\Projects\hello\Debug\hello.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Users\Shankar\Documents\Visual Studio 2005\Projects\hello\hello\Debug\BuildLog.htm"
1>hello - 23 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

All this for a small "Hello World" program that uses only cout.

I tried building it with Visual Studio 2005 as well as Visual C++ 2008 Express and I get the same errors.

Can anyone let me know what I am supposed to do? Thanks.

Shankar
AnswerRe: Static linking not working Pin
scorpiodx18-Oct-08 6:45
scorpiodx18-Oct-08 6:45 
QuestionIn vc6 debugger, edit and continue doesn't work Pin
sashoalm18-Oct-08 0:15
sashoalm18-Oct-08 0:15 
Questionbuttons in VC++2005 Pin
RNarayan18-Oct-08 0:04
RNarayan18-Oct-08 0:04 
AnswerRe: buttons in VC++2005 Pin
santhoshv8418-Oct-08 0:44
santhoshv8418-Oct-08 0:44 
AnswerRe: buttons in VC++2005 Pin
Hamid_RT18-Oct-08 9:14
Hamid_RT18-Oct-08 9:14 
QuestionHow to store bmp using URLDownloadToFile from a URL ? Pin
Rahul Vaishnav17-Oct-08 23:31
Rahul Vaishnav17-Oct-08 23:31 
AnswerRe: How to store bmp using URLDownloadToFile from a URL ? Pin
Hamid_RT18-Oct-08 9:14
Hamid_RT18-Oct-08 9:14 
AnswerRe: How to store bmp using URLDownloadToFile from a URL ? Pin
Michael Dunn18-Oct-08 17:21
sitebuilderMichael Dunn18-Oct-08 17:21 
AnswerRe: How to store bmp using URLDownloadToFile from a URL ? Pin
Rahul Vaishnav21-Oct-08 18:30
Rahul Vaishnav21-Oct-08 18:30 
Question[Message Deleted] Pin
AnayKulkarni17-Oct-08 22:53
AnayKulkarni17-Oct-08 22:53 
AnswerRe: How to remove maximize button and its box from application's main window in MDI application? Pin
santhoshv8418-Oct-08 0:35
santhoshv8418-Oct-08 0:35 
Questionhow to store character in string using MFC? Pin
sn00pi17-Oct-08 20:36
sn00pi17-Oct-08 20:36 
QuestionRe: how to store character in string using MFC? Pin
CPallini17-Oct-08 22:03
mveCPallini17-Oct-08 22:03 
AnswerRe: how to store character in string using MFC? Pin
sn00pi17-Oct-08 23:00
sn00pi17-Oct-08 23:00 
GeneralRe: how to store character in string using MFC? Pin
CPallini17-Oct-08 23:10
mveCPallini17-Oct-08 23:10 
GeneralRe: how to store character in string using MFC? Pin
sn00pi17-Oct-08 23:47
sn00pi17-Oct-08 23:47 
GeneralRe: how to store character in string using MFC? Pin
CPallini18-Oct-08 0:52
mveCPallini18-Oct-08 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.