Library doesn't open
-
@alexfi Is there only one library file? Sometimes functionality is spread across several library files.
-
-
@jsulm
There are two files available. The 64bit version and the 32bit version, I tried both and installed them into the C: programm folder.
after I get the undefinded reference there error there was the collect2.exe error. -
@christian-ehrlicher
I tried -lBitLib before, but there was the error lBitlib not found. After I changed the to -BitLib it was found. I thought that was linux syntax. Mabe you can help me to get this run.
I installed the library in the C: folder after that I include this two lines in the pro file. i also added the header file in the projectINCLUDEPATH +=C:/BitScope64/Library LIBS += -LC:/BitScope64/Library -lBitLib
then i receive cannot find lBitLib
the structure of the library folder is following:
->Library ->Document bitlib.def BitLib.dll bitlib.h BitLib.lib BitLib.pas -BitLib.dll -BitScope.prb -BitServe.prb
-
@alexfi spolier alert: not tested! Could it be possible you need this? this is, telling the linker to use a library that doesn't follow the libNAME.so convention
-
It's msvc, so according to the docs it must be
LIBS += C:/BitScope64/Library/BitLib.lib
-
I am not sure how to include this correct in my pro. file do you have an example or some explanations for this?
g++ -o build/bin/myapp _mylib.so other_source_files
Thank you for your help!!!
@Christian-Ehrlicher
I tried this also, but I get the undefined reference.Thank you also for your help!!!
i also changed the library files from 64bit to 32bit because of that
//qmake: qmake.exe ConnectBitScope.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
-
@alexfi said in Library doesn't open:
do you have an example or some explanations for this?
have you checked the answers to that post? (hint: see #1...)
-
@alexfi said in Library doesn't open:
LIBS += -LC:/BitScope64/Library -lBitLib
I have done that several times and it used to work with MinGW and MSVC too. Can you show the linker command line from Compile Output?
Which MSVC version do you use?
The reason to prefer the
-L/path/to/lib -llibname
syntax is that Creator recognizes this and adds/path/to/lib
to your Run Environment so your program finds the DLL automatically. -
@christian-ehrlicher I used that syntax before, but even MSVC can be feed with the Linux syntax (I guess qmake maps that), and that has advantages in Creator, see my last post.
-
@aha_1980
I think this is the Compile Output you need:g++ -Wl,-subsystem,console -mthreads -o debug\ConnectBitScope.exe debug/main.o -LC:\BitScope32\Library\BitLib.lib debug/main.o: In function `main': C:\Users\adm-eep\Documents\ConnectBitScope\build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug/../ConnectBitScope/main.cpp:23: undefined reference to `BL_Open' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Debug:66: debug/ConnectBitScope.exe] Error 1 mingw32-make: *** [Makefile:38: debug] Error 2 mingw32-make[1]: Leaving directory 'C:/Users/adm-eep/Documents/ConnectBitScope/build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug'
I use the MSVC 11.0
I saw the example but i think this is for librarys with the ending .so I am no sure how to use this in my case
-
@alexfi said in Library doesn't open:
I use the MSVC 11.0
In that case, something is really weird set up - no wonder that it doesn't work.
Your compile output clearly shows the MinGW linker running.
Can you please show the screenshots of Tools > Options > Kits for Kits, Qt versions and compilers?
Regards
-
@alexfi said in Library doesn't open:
librarys with the ending .so
you may want to try with .lib in your case
-
@Pablo-J-Rogina
I tried it like this :g++ -o$$PWD/ $$PWD/BitLib.lib but i get the "extra characters after test expression" error
-
@manuja said in Library doesn't open:
LNK1104
This shows that you used the msvc linker before
BitLib.lib
This shows that the library was build with msvc
So if bitlib is a plain C library you can create a proper import lib with reimp & co (google is your friend) or you can try to link directly against the dll -> -lC:/BitScope64/Library/BitLib.dll - it should work with a recent MinGW version iirc.
If it's a c++ library than you have to recompile it with g++ to get a proper import lib (BitLib.a) -
@christian-ehrlicher
okay, if i under stand you right i have to reimport the lib, because it is written in c BitScope Librarys and this Bitscope example in C .I tried this:
LIBS += -lC:/BitScope64/Library/BitLib.dll - it
the direct link doesn't work if I use it like this because of the ending "- it".
is the reimport something i do in my actual project or is external work?
-
@alexfi said in Library doesn't open:
because of the ending "- it".
Where does this come from? Your library is named BitLib.dll ...
-
@christian-ehrlicher sorry my fault. I just didn't read the following sentence after your recommendation, but i also tried it without and it gave me back undefined reference. Now i try to find out how to reimport the lib.
-
@alexfi Just a note: the only Kit you have is one for MinGW not MSVC...
-
@jsulm thank you for your answer. Do I understand this right, that these basic settings should work?