I am creating a small Qt Application which uses an external library. I have the header file and lib file. My pro file is
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = IndexCreator
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../ExternalLibrary/ -lHASHLIB
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../ExternalLibrary/ -lHASHLIBd
INCLUDEPATH += $$PWD/../ExternalLibrary
DEPENDPATH += $$PWD/../ExternalLibrary
And I get this error:
12:01:11: Running steps for project IndexCreator...
12:01:11: Configuration unchanged, skipping qmake step.
12:01:11: Starting: "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe"
C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake.exe -spec win32-g++ -o Makefile ..\IndexCreator\IndexCreator.pro
C:/Qt/Qt5.2.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'G:/Projects/PDT/IndexCreator/build-IndexCreator-Desktop_Qt_5_2_1_MinGW_32bit-Release'
g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\IndexCreator.exe release/main.o release/mainwindow.o release/moc_mainwindow.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain -LG:/Projects/PDT/IndexCreator/IndexCreator/../ExternalLibrary/ -lHASHLIB -LC:\Qt\Qt5.2.1\5.2.1\mingw48_32\lib -lQt5Widgets -lQt5Gui -lQt5Core
G:/Projects/PDT/IndexCreator/IndexCreator/../ExternalLibrary//HASHLIB.lib: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Makefile.Release:80: recipe for target 'release\IndexCreator.exe' failed
mingw32-make[1]: *** [release\IndexCreator.exe] Error 1
mingw32-make[1]: Leaving directory 'G:/Projects/PDT/IndexCreator/build-IndexCreator-Desktop_Qt_5_2_1_MinGW_32bit-Release'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
12:01:13: The process "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project IndexCreator (kit: Desktop Qt 5.2.1 MinGW 32bit)
When executing step 'Make'
12:01:13: Elapsed time: 00:02.
I need to use the function from this library.
It seems that you are mixing mingw (your toolchain setup) and msvc (how hashlib is built). This should be avoided at almost all cost if possible on Windows, even the latest versions.
As you do not seem to have access to the source code, if you cannot get the vendor to supply a mingw version, you either better drop mingw for your project, or hashlib as a dependency.