[Solved] Wrong JPEG library version: library is 90, caller expects 80
I'm trying to deploy a static Windows application using Qt, which also links in some static OpenCV libraries. When opening a jpeg or jpg file in my program, I get an error: "Wrong JPEG library version: library is 90, caller expects 80". I believe this is a conflict between Qt's libjp2.a library (found in C:\Qt\Static\5.3\plugins\imageformats) and OpenCV's liblibjpeg.a, which I am linking.
I think Qt automatically links libjp2.a when it deploys the static app; however, is there a way to tell Qt not to link it?
Edit: Reference to anyone with this Wrong JPEG error in the future, I solved it by downloading libjpeg version 80, which can be found here: http://www.ijg.org/files/ and http://stackoverflow.com/questions/12652178/compiling-libjpeg is a wonderful tutorial on how to compile the libjpeg source code into a static library. Note that the tutorial can only be used if you are using Windows and are using a MinGW compiler with Qt Creator.
After you successfully build lilbjpeg.a, you have to rebuild OpenCV so that it uses this file. I used the CMake-gui (I had version 3.1.1), make sure you have BUILD_JPEG=OFF, and WITH_JPEG=ON. Click the "Add entry" button, type in a name and select "PATH" for the type. Locate the "Include" folder that was created when you compiled libjpeg, then press OK. Click "Add entry" again, select "FILEPATH" for the type, and locate your libjpeg.a file, press OK. Click configure, then generate. Re-compile your generated OpenCV build using mingw32-make and mingw32-make install. Once complete, you can copy libjpeg.a into your OpenCV folder containing all your other static libraries. Your new jpeg library is the same version as Qt's libjpeg, and it should resolve the jpeg version conflict. :) Good luck.