Results 1 to 1 of 1

Thread: GraphicsMagick & Qt -- undefined reference to '_imp__InitializeMagick' (MinGW Win XP)

  1. #1
    Join Date
    Jul 2014
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default GraphicsMagick & Qt -- undefined reference to '_imp__InitializeMagick' (MinGW Win XP)

    Trying to get GraphicsMagick to play with Qt. Built GraphicsMagick from source using the same MinGW that came with Qt5.3. GM was built to yield static libraries. MSYS GUI wasn't installed so used MSYS command line shell and as a result had to put GM source inside the MSYS file tree, hence the weird locations shown in the .pro file.

    Getting this error: undefined reference to '_imp__InitializeMagick'.

    I may be mixing things up somehow between the 'C' API and C++. With C++ I'm getting about the same error but it's mangled. I'd prefer to go the 'C' route as I know it better. I apologize if this isn't an appropriate question for this forum but I don't know where else to go with it. Thanks

    Here is the .pro file:
    Qt Code:
    1. QT += core gui
    2.  
    3. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    4.  
    5. TARGET = GraphicsMagickTest
    6. TEMPLATE = app
    7.  
    8.  
    9. SOURCES += main.cpp\
    10. mainwindow.cpp
    11.  
    12. INCLUDEPATH += C:/msys/1.0/local/include/GraphicsMagick \
    13. C:/msys/1.0/local/include/GraphicsMagick/magick \
    14. C:/msys/1.0/local/include/GraphicsMagick/Magick++ \
    15. C:/msys/1.0/local/include/GraphicsMagick/wand
    16.  
    17. LIBS += -L"C:\msys\1.0\local\lib"
    18. LIBS += -lGraphicsMagick++ -lGraphicsMagickWand -lGraphicsMagick
    19.  
    20. HEADERS += mainwindow.h
    21.  
    22. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 

    And the source code:

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. //#include <Magick++> <== this doesn't work, says "no such file or directory"
    5. ///#include "Magick++.h"
    6. #include <magick/api.h>
    7. #include "Magick.h"
    8.  
    9. //using namespace Magick;
    10.  
    11.  
    12. MainWindow::MainWindow(QWidget *parent) :
    13. QMainWindow(parent),
    14. ui(new Ui::MainWindow)
    15. {
    16. InitializeMagick(NULL);
    17.  
    18. ui->setupUi(this);
    19. }
    To copy to clipboard, switch view to plain text mode 

    and the compiler output:

    C:/Qt/Qt5.3.0/Tools/mingw482_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/QtProjects/build-GraphicsMagickTest-MinGW_Qt5_3-Debug'
    g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../GraphicsMagickTest -I'../../msys/1.0/local/include/GraphicsMagick' -I'../../msys/1.0/local/include/GraphicsMagick/magick' -I'../../msys/1.0/local/include/GraphicsMagick/Magick++' -I'../../msys/1.0/local/include/GraphicsMagick/wand' -I'../../Qt/Qt5.3.0/5.3/mingw482_32/include' -I'../../Qt/Qt5.3.0/5.3/mingw482_32/include/QtWidgets' -I'../../Qt/Qt5.3.0/5.3/mingw482_32/include/QtGui' -I'../../Qt/Qt5.3.0/5.3/mingw482_32/include/QtCore' -I'debug' -I'.' -I'.' -I'../../Qt/Qt5.3.0/5.3/mingw482_32/mkspecs/win32-g++' -o debug/mainwindow.o ../GraphicsMagickTest/mainwindow.cpp
    g++ -Wl,-subsystem,windows -mthreads -o debug/GraphicsMagickTest.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:\msys\1.0\local\lib -lGraphicsMagick++ -lGraphicsMagickWand -lGraphicsMagick -LC:/Qt/Qt5.3.0/5.3/mingw482_32/lib -lQt5Widgetsd -lQt5Guid -lQt5Cored
    debug/mainwindow.o: In function `ZN10MainWindowC2EP7QWidget':
    C:\QtProjects\build-GraphicsMagickTest-MinGW_Qt5_3-Debug/../GraphicsMagickTest/mainwindow.cpp:16: undefined reference to `_imp__InitializeMagick'
    collect2.exe: error: ld returned 1 exit status
    Last edited by faraday; 2nd July 2014 at 05:06. Reason: linking to static library, not shared

Similar Threads

  1. Replies: 1
    Last Post: 15th January 2014, 08:14
  2. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 15:45
  3. Replies: 4
    Last Post: 5th October 2010, 12:38
  4. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  5. Undefined reference
    By Salazaar in forum Newbie
    Replies: 12
    Last Post: 23rd May 2007, 10:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.