Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Linking to external software system in Qt project ( libraries , dll on Windows ) GraphicsMagick
QtWS25 Last Chance

Linking to external software system in Qt project ( libraries , dll on Windows ) GraphicsMagick

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 11.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    swhweng
    wrote on last edited by
    #1

    Hello.
    Does anybody know how to link to GraphicsMagick / ImageMagick:

    "GraphicsMagick":http://www.graphicsmagick.org

    libraries on Windows in Qt project :

    I've installed

    GraphicsMagick-1.3-Q8-windows-dll.exe

    and after installation there is a folder that contains multiple .dlls in it on Windows.

    I need next includes will be recognized by mingw :

    @#include <GraphicsMagick/Magick++/Image.h>
    #include <GraphicsMagick/Magick++/STL.h>@

    but after I try in .pro file to put next line:

    @LIBS += -lMagick++ -lWand -lMagick @

    I've got next compilation problem ( mingw ):

    @..\main_control_1/mainwindow.h:58:43: error: GraphicsMagick/Magick++/Image.h: No such file or directory
    ..\main_control_1/mainwindow.h:59:41: error: GraphicsMagick/Magick++/STL.h: No such file or directory@

    On Linux I've succeed to link to the GraphicsMagick using pkgconfig.

    I've looked through several sources such that:
    "Similar discussion at StackOverflow":http://stackoverflow.com/questions/4141312/how-to-link-imagemagick-library-to-qtwindows

    and documentation/manuals but can't find out / understand what rows to put to Qt .pro files so the project will compile on Windows ( compiling system is mingw ).

    What lines to enter in .pro file so that the linker will find all needed GraphicsMagick/Image Magick headers and will compile ?

    Thanks in advance.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      You have to add the paths to the include files and the libraries to your .pro file, as with any other external library.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        swhweng
        wrote on last edited by
        #3

        Hi.I hope it should be linked as usual , but now here the facts I get when :

        after installing ImageMagick from Windows installer:

        in .pro file I've added:

        @INCLUDEPATH += C:\Program Files\ImageMagick-6.7.3-Q8\include
        C:\Program Files\ImageMagick-6.7.3-Q8\include\magick
        C:\Program Files\ImageMagick-6.7.3-Q8\include\Magick++
        C:\Program Files\ImageMagick-6.7.3-Q8\include\wand

        LIBS += C:\Program Files\ImageMagick-6.7.3-Q8*.dll
        @

        and including in Qt project by providing pathes to headers : .h files :

        @
        #include "C:\Program Files\ImageMagick-6.7.3-Q8\include\Magick++\Image.h"
        #include "C:\Program Files\ImageMagick-6.7.3-Q8\include\Magick++\STL.h"
        @

        but part of directories from pathes above to desired to be included headers can't "be seen" ( can't be found ) Magick++ for example.

        Yet not solved. I need perhaps somebody reliable and understand very well in connecting externals software modules to Qt project that have time and willing to help then if he has patience and time and we begin to cooperate we should create Qt project that uses 2 - 3 large external software systems on Windows , one can get upon successfull completion experience and perhaps some fee from me ( unfortunatelly I have very limited budgets last time ). Thanks.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          If you set INCLUDEPATH in the .pro, you do not need the full path in your own headers.

          So, you just need to add

          @
          #include <Magick++>
          @

          And you must not link against the DLLs, but against the corresponding stub libs:

          @

          check the path

          LIBS += -L"C:\Program Files\ImageMagick-6.7.3-Q8\libs"

          if you're on MinGW use this

          LIBS += -lGraphicsMagick++ -lGraphicsMagickWand -lGraphicsMagick

          or if you're on visual studio use this

          LIBS += -lCORE_RL_Magick++_ -lCORE_RL_Wand_ -lCORE_RL_Magick_
          @

          EDIT/PS:
          If you have paths containing spaces, you need to enclose those in quotes!

          @
          INCLUDEPATH += "C:\Program Files\ImageMagick-6.7.3-Q8\include"
          @

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wspilot
            wrote on last edited by
            #5

            Hi,
            I am trying to port a linux Qt application to Widows, using mingw. The problem is with imagemagick libs. Have put the magick libs and headers (magick mingw version) in place. They are found by mingw (gcc), but I am getting many 'undefined references', caused by not finding image.cpp somewhere in the (mingw) msys system. I am not an mingw expert, but it's clear that Qt is not using msys.
            Maybe Qt should warn about using mingw. I have been googling and trying for days now and I see many mailings from people getting stuck here, and none of the solutions work.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Welcome to DevNet!

              The actual error message would be helpful, as well as your settings for LIBS and INCLUDEPATH variables of your .pro file.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • W Offline
                W Offline
                wspilot
                wrote on last edited by
                #7

                Thanks for the reply.
                I'll give you the data of the latest attempt.

                @
                INCLUDEPATH += C:/QtSDK/mingw/ImageMagick-6.6.9/include/ImageMagick
                LIBS += C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagickCore.a C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagick++.a C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagickWand.a
                QMAKE_CXXFLAGS += -I../../include
                TARGET.EPOCSTACKSIZE = 64000000
                @

                I put the lib (magick mingw build) including .a .la etc in correct dirs.
                Got errors about not finding Image.cpp on the path below.
                So I created this dir: C:\msys\1.0\home\cristy
                and put the magick source tree in the there. Image.cpp is now found.
                Few thousand errors:

                @
                C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.9-2/Magick++/lib/Image.cpp:4281: undefined reference to MagickCoreGenesis' C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.9-2/Magick++/lib/Image.cpp:4242: undefined reference to GetExceptionInfo'
                C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.9-2/Magick++/lib/Image.cpp:4245: undefined reference to SetImageRegistry' C:/QtSDK/mingw/ImageMagick-6.6.9/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.9-2/Magick++/lib/Image.cpp:4247: undefined reference to DestroyExceptionInfo'
                ....
                @

                So, nothing wrong with Qt, but mingw is acting strange. If you google you'll see that the same problems apply to other libraries as well.
                r.
                wim

                [EDIT: code formatting, Volker]

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  Hm, strange. Seems to be much more an ImageMagick issue. I would advice to ask in a special forum over there to check out what actually needs to be linked (or change on installing etc.). The libs and include paths then can be easily adapted in the .pro file. Feel free to come back here if you need some advice on how to include the settings into the qmake project file.

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    inejose
                    wrote on last edited by
                    #9

                    [quote author="Volker" date="1323212633"]
                    EDIT/PS:
                    If you have paths containing spaces, you need to enclose those in quotes!

                    @
                    INCLUDEPATH += "C:\Program Files\ImageMagick-6.7.3-Q8\include"
                    @[/quote]

                    Thank you!! :) that was the problem, I was using the "Add Library..." Qt Creator command and it doesn't add the quotes...

                    should be this point considered as a Qt Creator issue?? It made me spend 4 hours!!

                    thanks again @Volker

                    call it version 1.0 <a href="http://www.clicpsicologos.com">psicologo online</a> & <a href="http://www.isomus.com">musicoterapia</a>

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      inejose
                      wrote on last edited by
                      #10

                      [quote author="Volker" date="1323212633"]
                      EDIT/PS:
                      If you have paths containing spaces, you need to enclose those in quotes!

                      @
                      INCLUDEPATH += "C:\Program Files\ImageMagick-6.7.3-Q8\include"
                      @[/quote]

                      Thank you!! :) that was the problem, I was using the "Add Library..." Qt Creator command and it doesn't add the quotes...

                      should be this point considered as a Qt Creator issue?? It made me spend 4 hours!!

                      thanks again @Volker

                      call it version 1.0 <a href="http://www.clicpsicologos.com">psicologo online</a> & <a href="http://www.isomus.com">musicoterapia</a>

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved