qt-creatormagick++

How can I add Magick++ to Qt Creator


Good day. I am trying to set up my Qt Creator to use Magick++. I've added

INCLUDEPATH += /usr/local/Cellar/imagemagick/7.0.8-23/include/ImageMagick-7

And that sort of worked, I can now add

#include <Magick++.h>

It does autocomplete and everything. But I get a lot of warnings that I am supposed to set MAGICKCORE_QUANTUM_DEPTH and MAGICKCORE_HDRI_ENABLE to sensible values. I have no idea what it is and how to do it. I've tried to research this topic but only found that I need to add Lib files like this:

QMAKE_CXXFLAGS += $(shell Magick++-config --cppflags --cxxflags)
LIBS += $(shell Magick++-config --ldflags --libs)

but that only added an error: :-1: error: Magick++-config: Command not found

I am using the latest version of Qt creator. ImageMagick-7. Mac OSX Mojave


Solution

  • Both MAGICKCORE_QUANTUM_DEPTH & MAGICKCORE_HDRI_ENABLE must be added to qmake's DEFINES variable.

    Try the following...

    QMAKE_CXXFLAGS += $(shell Magick++-config --cxxflags)
    LIBS += $(shell Magick++-config --libs)
    DEFINES += "MAGICKCORE_QUANTUM_DEPTH=16"
    DEFINES += "MAGICKCORE_HDRI_ENABLE=1"
    

    ... assuming you are running ImageMagick-7 Q16 HDRI library.