MinGW32 and IM Magick::Image::read undefined reference

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
SIllydan
Posts: 2
Joined: 2016-11-29T12:25:27-07:00
Authentication code: 1151

MinGW32 and IM Magick::Image::read undefined reference

Post by SIllydan »

Hi,
Sorry if this is not the correct place to ask such a question. I'm new here.
I've been working on this issue for almost... holy crap.. 11 hours?
I can't for the life of me get my MinGW32 version of g++ to recognize ImageMagick. I have downloaded the latest MinGW binary release from here: http://www.imagemagick.org/script/binary-releases.php
I am trying to simply compile this simple c++ program:

Code: Select all

#include "Magick++.h"

using namespace Magick;

int main(int argc, char** argv)
{
	Image pic;
	pic.read("a.bmp");
	pic.crop(Geometry(100, 100, 100, 100));
	pic.write("b.bmp");
	return 0;
}
Using these compiler statements:
  • g++ -Wall -O2 -std=gnu++11 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -c main.cpp
  • g++ -Wall -O2 -std=gnu++11 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -o main main.cpp -L. -llibMagick++-6.Q16-1
My folder structure is this:

Code: Select all

$ ls
Magick++                 libMagickCore-6.Q16-1.dll  main.cpp
Magick++.h               libMagickWand-6.Q16-1.dll  main.o
libMagick++-6.Q16-1.dll  magick                     wand
But I keep getting this error:

Code: Select all

C:\Users\SorenRyge\AppData\Local\Temp\cctu0zXM.o:main.cpp:(.text.startup+0x49):
undefined reference to `Magick::Image::read(std::__cxx11::basic_string<char, std
::char_traits<char>, std::allocator<char> > const&)'
C:\Users\SorenRyge\AppData\Local\Temp\cctu0zXM.o:main.cpp:(.text.startup+0xd9):
undefined reference to `Magick::Image::write(std::__cxx11::basic_string<char, st
d::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
(I btw edited the magick headerfiles to include eachother.)
(I have tried to compile ImageMagick myself, but niether the compilation or installation works with MinGW32 in my experience)

Thanks in advance.
SIllydan
Posts: 2
Joined: 2016-11-29T12:25:27-07:00
Authentication code: 1151

Re: MinGW32 and IM Magick::Image::read undefined reference

Post by SIllydan »

Update: I fixed my issue by trashing everything I had and used SOIL for texture loading instead. ImageMagick was overkill anyways
Post Reply