Include CR95HF dll in Qt Quick
I would like to connect a CR95HF reader in USB on my computer and use it with a Qt Quick application (A CR95HF reader is a NFC reader and it will allow me to write and read in a EEPROM in NFC). For that I have 3 files: CR95HF.dll, CR95HF.h and CR95HF.lib.
I tried to add the .dll on my .pro and include the .h in my "main.cpp". All the files are on my project's folder.
In my .pro I have:
LIBS += -L"CR95HF.dll"
and in my .h:
but when I try to use a function I have these messages
undefined reference to 'function_name()@0' error: ld returned 1 exit status
Could you help me to solve this probleme ?
Thank you for your help
Have a good day
-Lis to give additional paths to the linker to search in for libraries.
Also, you don't like against .dll files, these are share libraries. On Windows you link against .lib files if using a VS compiler.
You should rather have something like
LIBS += -L$$PWD -lCR95HFin your .pro file.
Thank you for your quick response.
Few minutes ago I tried with the import library tool in Qt.
I also create a DLL folder and put all the files inside. So now I have
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/DLL/ -lCR95HF else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/DLL/ -lCR95HF else:unix: LIBS += -L$$PWD/DLL/ -lCR95HF
It's close to your solution but the problem still the same...
What compiler are you using ?
What is the architecture of your application ? 32 or 64 bit ?
Same questions for your CR95HF library..
@SGaist My compiler is the Qt 5.8.0 MinGW 32 bit.
The architecture is 32 bit also.
My library is coming from STmicroelectronics so I have no idea of the used tool to compile and create it...
@SGaist In your opinion the problem is caming from the compiler ?
Yes, on Windows you can't mix and match C++ libraries built with different compilers. The only current exception is VS2017 which is compatible with VS2015.
So I have to install the correct compiler on my computer and compile my Qt project with the good one ?
If it's indeed a C++ library, then yes, you have to get the matching version of Visual Studio because the documentation only mentions VS for development however not which version. You should try asking ST for more details.
Thank you for your help, thanks to your help I solved my problem. In first I have completely uninstall Qt and install again with the MSCV2013 compiler. After that I installed Visual studio community 2013 and that solve my problem.
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)