Errors using ImageMagick in C++ project in Visual Studio 2017

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
hddsdd
Posts: 2
Joined: 2019-07-27T02:01:36-07:00
Authentication code: 1152

Errors using ImageMagick in C++ project in Visual Studio 2017

Post by hddsdd »

I have a C++ project in Visual Studio 2017.

I download this and installed (while installing I added headers c++ button and related things)
https://imagemagick.org/script/download.php#windows
ImageMagick-7.0.8-56-Q16-x86-dll.exe

And I added inlude and lib folders on my project.

My project codes:

Code: Select all

#include <Magick++.h>

int main() {
  Magick::Image first,second;
  first.read ("c:\\1x1.png");
  second.read("c:\\2x2.png");
  first.composite(second, 150, 150);
  first.write("c:\\0_0.png");
}
I got these errors and there are 5 error like that:

Code: Select all

1>man.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ) referenced in function _main

Code: Select all

1>man.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::write(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?write@Image@Magick@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main

and then I added CORE_RL_magick++_.lib, CORE_RL_MagickCore_.lib, CORE_RL_MagickWand_.lib in lib folder of ImageMagick to in Linker-Input in my C++ project on Visual Studio 2017.

Then other errors disappeared and I got this error:

Code: Select all

Unhandled exception 0x51477C50 CORE_RL_MAGICK++_.dll Access violation writing location

So I couldn't use ImageMagick in Visual Studio 2017.
Can someone help me ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Errors using ImageMagick in C++ project in Visual Studio 2017

Post by snibgo »

I don't use Visual Studio, but I notice you installed the x86 version, which is for 32-bit Windows. If you have 64-bit Windows, you probably need the x64 version.
snibgo's IM pages: im.snibgo.com
proxy2
Posts: 1
Joined: 2019-08-01T22:37:36-07:00
Authentication code: 1152

Re: Errors using ImageMagick in C++ project in Visual Studio 2017

Post by proxy2 »

I have Visual Studio 2017 on Windows 7 installed and I have the same error:
Ausnahme ausgelöst bei 0x000007FED57B938D (CORE_RL_Magick++_.dll) in imagickCode.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0xFFFFFFFFFFFFFFFF.
I use ImageMagick-7.0.8-58-Q16-x64-dll.exe. any help is welcome.
Post Reply