compiling magick++ on dev-c++

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
tsftd
Posts: 28
Joined: 2012-01-14T11:46:55-07:00
Authentication code: 8675308

compiling magick++ on dev-c++

Post by tsftd »

having gotten fed up with msvs, i've switched to Dev-C++ (5.4.2, orwell fork), and simultaneously am doing a rewrite of my code. Unfortunately, I can't get Magick++ to compile, and haven't really been able to pin down the issue via google or these forums. Loading the demo program flip.cpp yields:

26 0 C:\Dev-Cpp\Magick++\Magick++\Include.h In file included from C:\Dev-Cpp\Magick++/Magick++/Include.h
9 C:\Dev-Cpp\Magick++\Magick++.h from C:\Dev-Cpp\Magick++/Magick++.h
11 C:\Program Files\ImageMagick-6.8.6-Q16\Magick++_Demo\flip.cpp from C:\Program Files\ImageMagick-6.8.6-Q16\Magick++_Demo\flip.cpp
775 25 c:\dev-cpp\mingw64\x86_64-w64-mingw32\include\math.h [Error] expected ')' before '(' token

for reasons likely involving the blackest of magics, adding this to the includes allows this error to be bypassed:

Code: Select all

#define BOOST_THREAD_USE_LIB
#include <windows.h>
#include <boost/thread.hpp>
#include <boost/thread/lockable_concepts.hpp>
#include <stdio.h>
#include <fstream>
#include <limits>
//#include <stdlib.h>
#include <sstream>
//#include <vector>
//#include <bitset>
//#include <iostream>
//#include <list>
//#include <algorithm>
//#include <fstream>
#include <boost/filesystem.hpp>
however, it introduces a more cryptic error:

C:\Users\tsftd\AppData\Local\Temp\ccUjJtZf.o flip.cpp:(.text$_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE[_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE]+0xaa): undefined reference to `Magick::Image::Image(MagickCore::_Image*)'
C:\Users\tsftd\AppData\Local\Temp\ccUjJtZf.o flip.cpp:(.text$_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE[_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE]+0xe2): undefined reference to `Magick::Image::Image(Magick::Image const&)'
c:\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe C:\Users\tsftd\AppData\Local\Temp\ccUjJtZf.o: bad reloc address 0xe2 in section `.text$_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE[_ZN6Magick12insertImagesISt4listINS_5ImageESaIS2_EEEEvPT_PN10MagickCore6_ImageE]'
c:\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe final link failed: Invalid operation
C:\Program Files\ImageMagick-6.8.6-Q16\Magick++_Demo\collect2.exe [Error] ld returned 1 exit status

it could be that mingw is gcc based, or it could just be that I'm Doing It Wrong, but any help would be appreciated.

if it's any help, the mostly empty project I started with:

Code: Select all

#define BOOST_THREAD_USE_LIB
#include <windows.h>
#include <boost/thread.hpp>
#include <boost/thread/lockable_concepts.hpp>
#include <stdio.h>
#include <fstream>
#include <limits>
//#include <stdlib.h>
#include <string>
#include <sstream>
//#include <vector>
//#include <bitset>
//#include <iostream>
//#include <list>
//#include <algorithm>
//#include <fstream>
#include <boost/filesystem.hpp>
#include <Magick++.h>

using namespace std;
using namespace boost::filesystem;
using namespace Magick;


int main(int argc, char** argv) {
	InitializeMagick(*argv);
	Image file();
	file.read("C:\\Dev-Cpp\\imagehack-i\\15-.png");

	return 0;
}
produces

C:\Dev-Cpp\testing\main.cpp In function 'int main(int, char**)':
28 7 C:\Dev-Cpp\testing\main.cpp [Error] request for member 'read' in 'file', which is of non-class type 'Magick::Image()'

commenting out the offending file.read yields:

C:\Dev-Cpp\testing\main.o main.cpp:(.text.startup+0x11): undefined reference to `Magick::InitializeMagick(char const*)'
C:\Dev-Cpp\testing\collect2.exe [Error] ld returned 1 exit status

and commenting out that allows the program to build with no errors, however I need to be able to do more than create an empty Image object.
Post Reply