IM and MFC in Debug mode causing link errors
Posted: 2008-03-06T13:11:50-07:00
Aloha all-
I have tried very hard to solve this entirely on my own with help from Google, but have had absolutely no joy. I am trying to write an app in VS2005 that links against ImageMagick-6.3.8. Using VS2005, I built the libs using the VisualStaticMT project I created using the wizard, along with all the samples. There were no errors in the build process.
I created a quick MFC-based dialog app that references just a couple of IM functions. I copied the settings from the UTIL_NtMagick_xt_exe sample MFC project in the contrib directory (adjusting for location of the project), went through all the compile and linking settings, included all the libs, and the project compiles, but at link I get:
If I tell the linker to ignore msvcprtd then I get a bajillion more linker errors for other standard C++ functions. So that doesn't seem like a good solution.
The release build of my sample project compiles, links, and runs fine (switching the libs to the *_RL_* files). The sample project also compiles, links, and runs fine in both Debug and Release modes.
I have opened up the project files in text editors and have been unable to find any special setting that I've missed that would somehow allow the sample project to link while mine cannot. What's stranger still is that the errors are not for ImageMagick functions, but STL stuff! If anything, I was shocked only because I thought the STL lived entirely within the header files, never ever being wrapped in any libs. Surprise to me!
So I'm at my wit's end. I could go back to old-school fprintf-style debugging from the release app, but regardless, the fact that one part doesn't build correctly, and I have no idea why, really really bugs me.
Might anyone have an idea where to look?
Thanks,
Tacho
I have tried very hard to solve this entirely on my own with help from Google, but have had absolutely no joy. I am trying to write an app in VS2005 that links against ImageMagick-6.3.8. Using VS2005, I built the libs using the VisualStaticMT project I created using the wizard, along with all the samples. There were no errors in the build process.
I created a quick MFC-based dialog app that references just a couple of IM functions. I copied the settings from the UTIL_NtMagick_xt_exe sample MFC project in the contrib directory (adjusting for location of the project), went through all the compile and linking settings, included all the libs, and the project compiles, but at link I get:
Code: Select all
1>msvcprtd.lib(MSVCP80D.dll) : 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in CORE_DB_Magick++_.lib(Image.obj)
1>msvcprtd.lib(MSVCP80D.dll) : 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in CORE_DB_Magick++_.lib(Image.obj)
1>msvcprtd.lib(MSVCP80D.dll) : 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@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in CORE_DB_Magick++_.lib(Image.obj)
1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: void __thiscall std::_Container_base::_Orphan_all(void)const " (?_Orphan_all@_Container_base@std@@QBEXXZ) already defined in CORE_DB_Magick++_.lib(Image.obj)
The release build of my sample project compiles, links, and runs fine (switching the libs to the *_RL_* files). The sample project also compiles, links, and runs fine in both Debug and Release modes.
I have opened up the project files in text editors and have been unable to find any special setting that I've missed that would somehow allow the sample project to link while mine cannot. What's stranger still is that the errors are not for ImageMagick functions, but STL stuff! If anything, I was shocked only because I thought the STL lived entirely within the header files, never ever being wrapped in any libs. Surprise to me!
So I'm at my wit's end. I could go back to old-school fprintf-style debugging from the release app, but regardless, the fact that one part doesn't build correctly, and I have no idea why, really really bugs me.
Might anyone have an idea where to look?
Thanks,
Tacho