Can't use Magick++ under Windows with Code::Blocks
Posted: 2017-05-08T06:39:48-07:00
Good morning everyone,
I'm new on c++ and I would like to use magick++ to make some tricks with images.
I read a lot of thing on internet but I can't figure out how to use magick++.
I saw a lot of thing about the folder Magick++_demo and the button.cpp file. So that's what I did :
I open Code::Blocks and I import a visual workspace and I select Magick++_Demo.dsw, I select the Gnu gcc compiler and here after importing all the files, I get a first error : "Fail to import *any* projects from workspace file. Well, why not ? Maybe there is no project file, only a workspace, all the files are imported.
I try to compile the button.cpp and I get an error about Magick++.h : No such file or directory.
After reading a lot of thing, I figured out that I needed to link the library. So that's what I did :
Project > Build options > Select Button > Search Directories > Compiler > C:\Program Files\ImageMagick-7.0.5-Q16\include
So, all the input file are linked
Project > Build options > Select Button > Search Directories > Link > C:\Program Files\ImageMagick-7.0.5-Q16\lib
So, all the lib are linked
Project > Build options > Select Button > Linker Settings :
I add the three libraries : CORE_RL_Magick++_.lib CORE_RL_MagickCore_.lib CORE_RL_MagickWand_.lib
So now, he found Magick++.h ! That's good right ? But nop, it still not working and that's why I'm there. I search like all the day why this shitty thing happen and I saw that I'm not the only one who faces this problem. But I never saw a solution for this problem. I get errors about undefined reference !
If someone know how to fix these undefined reference.
I saw that solution on the net but I don't know how to use it :
g++ `Magick++-config --cxxflags --cppflags` -o CmdLineClient CmdLineClient.cpp `Magick++-config --ldflags --libs`
where can I write this command compiler (I think it's a command to build the project) on Code::Blocks ?
Thank's in advance guys !
I'm new on c++ and I would like to use magick++ to make some tricks with images.
I read a lot of thing on internet but I can't figure out how to use magick++.
I saw a lot of thing about the folder Magick++_demo and the button.cpp file. So that's what I did :
I open Code::Blocks and I import a visual workspace and I select Magick++_Demo.dsw, I select the Gnu gcc compiler and here after importing all the files, I get a first error : "Fail to import *any* projects from workspace file. Well, why not ? Maybe there is no project file, only a workspace, all the files are imported.
I try to compile the button.cpp and I get an error about Magick++.h : No such file or directory.
After reading a lot of thing, I figured out that I needed to link the library. So that's what I did :
Project > Build options > Select Button > Search Directories > Compiler > C:\Program Files\ImageMagick-7.0.5-Q16\include
So, all the input file are linked
Project > Build options > Select Button > Search Directories > Link > C:\Program Files\ImageMagick-7.0.5-Q16\lib
So, all the lib are linked
Project > Build options > Select Button > Linker Settings :
I add the three libraries : CORE_RL_Magick++_.lib CORE_RL_MagickCore_.lib CORE_RL_MagickWand_.lib
So now, he found Magick++.h ! That's good right ? But nop, it still not working and that's why I'm there. I search like all the day why this shitty thing happen and I saw that I'm not the only one who faces this problem. But I never saw a solution for this problem. I get errors about undefined reference !
Code: Select all
||=== Build: default in button (compiler: GNU GCC Compiler) ===|
.objs\button.o:button.cpp|| undefined reference to `Magick::InitializeMagick(char const*)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::Color(char const*)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::Image()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::Geometry(std::string const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::size(Magick::Geometry const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::~Geometry()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::read(std::string const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::Image(std::string const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::texture(Magick::Image const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::Color(std::string const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::fillColor(Magick::Color const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::~Color()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::fontPointsize(double)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::annotate(std::string const&, MagickCore::GravityType)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::borderColor(Magick::Color const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::Geometry(char const*)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::frame(Magick::Geometry const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::~Geometry()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::depth(unsigned int)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::quantizeDither(bool)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::quantizeColors(unsigned int)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::quantize(bool)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::compressType(MagickCore::CompressionType)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::write(std::string const&)'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::~Image()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::~Image()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::~Color()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::~Geometry()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::~Color()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Geometry::~Geometry()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::~Image()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Image::~Image()'|
.objs\button.o:button.cpp|| undefined reference to `Magick::Color::~Color()'|
||error: ld returned 1 exit status|
||=== Build failed: 34 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
I saw that solution on the net but I don't know how to use it :
g++ `Magick++-config --cxxflags --cppflags` -o CmdLineClient CmdLineClient.cpp `Magick++-config --ldflags --libs`
where can I write this command compiler (I think it's a command to build the project) on Code::Blocks ?
Thank's in advance guys !