Linking error when using the static multithreaded librairies

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
minos
Posts: 1
Joined: 2016-04-13T23:08:12-07:00
Authentication code: 1151

Linking error when using the static multithreaded librairies

Post by minos »

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):

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
A piece of the program contains:

Code: Select all

#include <Magick++.h>

...

Magick::Image img;
img = Magick::Image(filename);
When compiling I get link errors:
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
The "dllimport" error suprises me, as I think there should be no DLL involved with the "static MT runtimes" I am using.

Any idea on how I could solve the problem?

Thanks.
Post Reply