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