Linking error when using the static multithreaded librairies
Posted: 2016-04-13T23:30:49-07:00
Hello,
I have trouble linking the ImageMagick lib files in my program that uses the Visual Studio MSVC 2015 compiler. Here are the steps I have followed:
I have compiled the static MT runtimes by using the "configure.exe" utility and built in Visual Studio the solution it generated: VisualStaticMT.sln. This creates lib files such as "CORE_RL_Magick++_.lib" in C:\ImageMagick-6.9.3-2\VisualMagick\lib.
In my C++11 program, the configuration relevant to ImageMagick is (I use QtCreator, but with the MSVC2015 compiler):
A piece of the program contains:
When compiling I get link errors:
Any idea on how I could solve the problem?
Thanks.
I have trouble linking the ImageMagick lib files in my program that uses the Visual Studio MSVC 2015 compiler. Here are the steps I have followed:
I have compiled the static MT runtimes by using the "configure.exe" utility and built in Visual Studio the solution it generated: VisualStaticMT.sln. This creates lib files such as "CORE_RL_Magick++_.lib" in C:\ImageMagick-6.9.3-2\VisualMagick\lib.
In my C++11 program, the configuration relevant to ImageMagick is (I use QtCreator, but with the MSVC2015 compiler):
Code: Select all
INCLUDEPATH += \
C:\ImageMagick-6.9.3-2\ImageMagick\Magick++\lib \
C:\ImageMagick-6.9.3-2\ImageMagick \
LIBS += \
-lC:\ImageMagick-6.9.3-2\VisualMagick\lib\CORE_RL_Magick++_ \
-lC:\ImageMagick-6.9.3-2\VisualMagick\lib\CORE_RL_wand_ \
-lC:\ImageMagick-6.9.3-2\VisualMagick\lib\CORE_RL_magick_
QMAKE_CXXFLAGS += \
-DMAGICKCORE_HDRI_ENABLE=0 \
-DMAGICKCORE_QUANTUM_DEPTH=16
Code: Select all
#include <Magick++.h>
...
Magick::Image img;
img = Magick::Image(filename);
The "dllimport" error suprises me, as I think there should be no DLL involved with the "static MT runtimes" I am using.movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Image::Image(void)" (__imp_??0Image@Magick@@QAE@XZ) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Image::Image(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??0Image@Magick@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Magick::Image & __thiscall Magick::Image::operator=(class Magick::Image const &)" (__imp_??4Image@Magick@@QAEAAV01@ABV01@@Z) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::write(long,long,unsigned int,unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum MagickCore::StorageType,void *)" (__imp_?write@Image@Magick@@QAEXJJIIABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4StorageType@MagickCore@@PAX@Z) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
movie.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct MagickCore::_Image const * __thiscall Magick::Image::constImage(void)const " (__imp_?constImage@Image@Magick@@QBEPBU_Image@MagickCore@@XZ) referenced in function "public: __thiscall Frame<unsigned char>::Frame<unsigned char>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0?$Frame@E@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
release\corr.exe : fatal error LNK1120: 6 unresolved externals
Any idea on how I could solve the problem?
Thanks.