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. Error when linking exiv2 with Qt project (Windows)

Error when linking exiv2 with Qt project (Windows)

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 705 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.
  • dublin19D Offline
    dublin19D Offline
    dublin19
    wrote on last edited by
    #1

    I get the following error when I link to exiv2 in my Qt project (also in debug mode):

        release/MainWindow.o:MainWindow.cpp:(.text+0x29c): undefined reference to `__imp__ZN5Exiv212ImageFactory4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb'
    
        collect2.exe: error: ld returned 1 exit status
        mingw32-make[1]: *** [Makefile.Release:85: release/RawImageDisplayer.exe] Error 1
    
    QT += core gui widgets multimedia sql
    TARGET = RawImageDisplayer
    TEMPLATE = app
    #CONFIG += c++11
    
    SOURCES += main.cpp \
                MainWindow.cpp \
                EmbeddedImage.cpp \
                exif.cpp \
                imagepreview.cpp
    
    
    HEADERS += MainWindow.h \
                EmbeddedImage.h \
                exif.h \
                imagepreview.h
    LIBS += $$quote(D:/_Projekte/ProductionLibraries/exiv2-0.27.2-MinGW64/lib/libexiv2.dll.a)
    LIBS += $$quote(D:/_Projekte/ProductionLibraries/exiv2-0.27.2-MinGW64/lib/libexiv2-xmp.a)
    #LIBS += -L/usr/local/lib -lexiv2
    #INCLUDEPATH += /usr/local/include
    INCLUDEPATH += $$quote(D:/_Projekte/ProductionLibraries/exiv2-0.27.2-MinGW64/include)
    

    I use mingw 64 bit and I got the same prebuilt binaries from the exiv2 website. Also I added the bin path to the system env variable PATH but at any time I get this error.

    Any thoughts? Many thanks.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Which compiler did you use to compile the exiv lib and which do you use now? Why did you remove 'CONFIG += c++11' ? The std::string ABI changed between c++0x and c++11 so you have to make sure both libs are compiled with the same (either both c++11 or none)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      dublin19D 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Which compiler did you use to compile the exiv lib and which do you use now? Why did you remove 'CONFIG += c++11' ? The std::string ABI changed between c++0x and c++11 so you have to make sure both libs are compiled with the same (either both c++11 or none)

        dublin19D Offline
        dublin19D Offline
        dublin19
        wrote on last edited by dublin19
        #3

        @Christian-Ehrlicher

        I use the prebuilt MinGW64 binaries from the exiv2 site. I removed c++11 because I saw that exiv2 was built using c++98.

        What I‘ve also seen is that the dll file inside the bin directory is called msys-exiv2...

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I don't think removing c++11 will work since the compiler automatically is using c++11 (I would guess, gcc defaults to c++11 for a long time already).
          Compile the exiv lib with a recent compiler, you won't be able to use Qt5.12 (or even 5.9) with something older than c++11.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          dublin19D 1 Reply Last reply
          1
          • Christian EhrlicherC Christian Ehrlicher

            I don't think removing c++11 will work since the compiler automatically is using c++11 (I would guess, gcc defaults to c++11 for a long time already).
            Compile the exiv lib with a recent compiler, you won't be able to use Qt5.12 (or even 5.9) with something older than c++11.

            dublin19D Offline
            dublin19D Offline
            dublin19
            wrote on last edited by
            #5

            @Christian-Ehrlicher But why is it then working on macOS and on Linux just like out of the box? I think I did something wrong when linking to it but I cannot really find the mistake I made...

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @dublin19 said in Error when linking exiv2 with Qt project (Windows):

              But why is it then working on macOS and on Linux just like out of the box?

              Because there exiv2 seems to be compiled with a recent compiler. Compile exiv on your own with the same compiler as you use for Qt.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1

              • Login

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