Include CR95HF dll in Qt Quick
-
Hi everybody,
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:
#include "CR95HFDLL.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 daySimon
-
Hi,
-L
is 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 -lCR95HF
in 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 havewin32: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..
-
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.
-
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.
-
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 :)