[solved]QImageReader problem in console app

  • Hi!
    I get following error:
    @C:/PROGRAMOWANIE/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Release
    mingw32-make.exe[1]: Entering directory C:/PROGRAMOWANIE/projekty/Qt/moje/dirs-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release' g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\dirs.exe release/main.o -L"c:\PROGRAMOWANIE\QtSDK\Desktop\Qt\4.8.0\mingw\lib" -lQtCore4 mingw32-make.exe[1]: Leaving directoryC:/PROGRAMOWANIE/projekty/Qt/moje/dirs-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release'
    release/main.o:main.cpp:(.text+0x8c): undefined reference to `_imp___ZN12QImageReader21supportedImageFormatsEv'
    collect2: ld returned 1 exit status
    mingw32-make.exe[1]: *** [release\dirs.exe] Error 1
    mingw32-make.exe: *** [release] Error 2@

    when compiling on Windows. With Ubuntu all goes right, with no problem so it must be something with included header file for this class.
    The code that i use is following:
    @foreach (QByteArray format, QImageReader::supportedImageFormats())@

    Any idea how to solve it?

  • QImageReader is in the QtGui module, to which you obivously don't link to.

    Did you forget <code>QT += gui</code> in your .pro file?

  • Holly s... what a shame ;)
    yeah I had QT -=gui
    I compiled it earlier on Linux without any errors. Strange. :o
    Thanks a lot.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.