PDA

View Full Version : GraphicsMagick & Qt -- undefined reference to '_imp__InitializeMagick' (MinGW Win XP)



faraday
2nd July 2014, 03:08
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 += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = GraphicsMagickTest
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

INCLUDEPATH += C:/msys/1.0/local/include/GraphicsMagick \
C:/msys/1.0/local/include/GraphicsMagick/magick \
C:/msys/1.0/local/include/GraphicsMagick/Magick++ \
C:/msys/1.0/local/include/GraphicsMagick/wand

LIBS += -L"C:\msys\1.0\local\lib"
LIBS += -lGraphicsMagick++ -lGraphicsMagickWand -lGraphicsMagick

HEADERS += mainwindow.h

FORMS += mainwindow.ui


And the source code:



#include "mainwindow.h"
#include "ui_mainwindow.h"

//#include <Magick++> <== this doesn't work, says "no such file or directory"
///#include "Magick++.h"
#include <magick/api.h>
#include "Magick.h"

//using namespace Magick;


MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
InitializeMagick(NULL);

ui->setupUi(this);
}



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