I can't link the libusb library and change UI
-
I have 2 issues that I think related. I've copied an entire project folder to another location on my computer as a base to start cause I want to add USB communication features. I added in the new project's folder the files of libusb library: libusb-1.0.dll and libusb-1.0.lib. After that I can build and run my application, but if I made any change in my code I get the error
:-1: error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
If I overwrite the libusb-1.0.dll and libusb-1.0.lib with the original ones, I can build and run my application again. Before EVERY build I have to copy and overwrite those libusb files!
But there is more: I can't modify my User Interface. If I add a button, for example, in the Design window of QtCreator, it doesn't appear in the UI.
Now I'm wonderig if I've imported (copied) the original project in the wrong way. The only thing that I changed after that was the build directory and nothing else.
Do you have any sugestion?
I'm working on a 64-bit environment. Following my .pro file (the last part about usblib comes from a external project, not mine)
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 qwt # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ audiometerinterface.cpp \ codecsettingsdialog.cpp \ eepromsettingsdialog.cpp \ evokedpotentialinterface.cpp \ infodevicedialog.cpp \ logsdialog.cpp \ main.cpp \ evometer.cpp \ terminaldialog.cpp \ tympanometryinterface.cpp \ usbconnection.cpp \ wellcomeinterface.cpp HEADERS += \ audiometerinterface.h \ codecsettingsdialog.h \ eepromsettingsdialog.h \ evokedpotentialinterface.h \ evometer.h \ infodevicedialog.h \ logsdialog.h \ terminaldialog.h \ tympanometryinterface.h \ usbconnection.h \ wellcomeinterface.h FORMS += \ audiometerinterface.ui \ codecsettingsdialog.ui \ eepromsettingsdialog.ui \ evokedpotentialinterface.ui \ evometer.ui \ infodevicedialog.ui \ logsdialog.ui \ terminaldialog.ui \ tympanometryinterface.ui \ wellcomeinterface.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target RESOURCES += \ imgs.qrc #------------------------------------------------- # Add LibUSB library #------------------------------------------------- #LIBS += -L.\ -llibusb-1.0 #------------------------------------------------- # Make sure to add the required libraries or # frameoworks for the demo work depending on # what OS is being used #------------------------------------------------- macx: LIBS += -framework CoreFoundation win32: LIBS += -lSetupAPI #------------------------------------------------- # Make sure output directory for object file and # executable is in the correct subdirectory #------------------------------------------------- macx { DESTDIR = mac OBJECTS_DIR = mac MOC_DIR = mac UI_DIR = mac RCC_DIR = mac } unix: !macx { DESTDIR = linux OBJECTS_DIR = linux MOC_DIR = linux UI_DIR = linux RCC_DIR = linux } win32 { DESTDIR = windows OBJECTS_DIR = windows MOC_DIR = windows UI_DIR = windows RCC_DIR = windows } OTHER_FILES += win32: LIBS += -L$$PWD/ -llibusb-1.0 INCLUDEPATH += $$PWD/ DEPENDPATH += $$PWD/
-
@jsulm said in I can't link the libusb library and change UI:
@Andrew23 Is this the same build folder you used before you copied the project?
The original project's folders are
.../QtProjects/Test/MyOriginalProject
.../QtProjects/Test/build-MyOriginalProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
now my copied project folders are
.../QtProjects/MyProject/MyNewQtProject
.../QtProjects/MyProject/build-MyNewQtProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
When I created the original project the framework choose the build forlder by default. When I copied the project in the new folder I inherited that and I changed it.
-
I have 2 issues that I think related. I've copied an entire project folder to another location on my computer as a base to start cause I want to add USB communication features. I added in the new project's folder the files of libusb library: libusb-1.0.dll and libusb-1.0.lib. After that I can build and run my application, but if I made any change in my code I get the error
:-1: error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
If I overwrite the libusb-1.0.dll and libusb-1.0.lib with the original ones, I can build and run my application again. Before EVERY build I have to copy and overwrite those libusb files!
But there is more: I can't modify my User Interface. If I add a button, for example, in the Design window of QtCreator, it doesn't appear in the UI.
Now I'm wonderig if I've imported (copied) the original project in the wrong way. The only thing that I changed after that was the build directory and nothing else.
Do you have any sugestion?
I'm working on a 64-bit environment. Following my .pro file (the last part about usblib comes from a external project, not mine)
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 qwt # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ audiometerinterface.cpp \ codecsettingsdialog.cpp \ eepromsettingsdialog.cpp \ evokedpotentialinterface.cpp \ infodevicedialog.cpp \ logsdialog.cpp \ main.cpp \ evometer.cpp \ terminaldialog.cpp \ tympanometryinterface.cpp \ usbconnection.cpp \ wellcomeinterface.cpp HEADERS += \ audiometerinterface.h \ codecsettingsdialog.h \ eepromsettingsdialog.h \ evokedpotentialinterface.h \ evometer.h \ infodevicedialog.h \ logsdialog.h \ terminaldialog.h \ tympanometryinterface.h \ usbconnection.h \ wellcomeinterface.h FORMS += \ audiometerinterface.ui \ codecsettingsdialog.ui \ eepromsettingsdialog.ui \ evokedpotentialinterface.ui \ evometer.ui \ infodevicedialog.ui \ logsdialog.ui \ terminaldialog.ui \ tympanometryinterface.ui \ wellcomeinterface.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target RESOURCES += \ imgs.qrc #------------------------------------------------- # Add LibUSB library #------------------------------------------------- #LIBS += -L.\ -llibusb-1.0 #------------------------------------------------- # Make sure to add the required libraries or # frameoworks for the demo work depending on # what OS is being used #------------------------------------------------- macx: LIBS += -framework CoreFoundation win32: LIBS += -lSetupAPI #------------------------------------------------- # Make sure output directory for object file and # executable is in the correct subdirectory #------------------------------------------------- macx { DESTDIR = mac OBJECTS_DIR = mac MOC_DIR = mac UI_DIR = mac RCC_DIR = mac } unix: !macx { DESTDIR = linux OBJECTS_DIR = linux MOC_DIR = linux UI_DIR = linux RCC_DIR = linux } win32 { DESTDIR = windows OBJECTS_DIR = windows MOC_DIR = windows UI_DIR = windows RCC_DIR = windows } OTHER_FILES += win32: LIBS += -L$$PWD/ -llibusb-1.0 INCLUDEPATH += $$PWD/ DEPENDPATH += $$PWD/
@Andrew23 said in I can't link the libusb library and change UI:
The only thing that I changed after that was the build directory and nothing else
Where is the build directory? Is it inside project directory?
-
@Andrew23 said in I can't link the libusb library and change UI:
The only thing that I changed after that was the build directory and nothing else
Where is the build directory? Is it inside project directory?
@jsulm said in I can't link the libusb library and change UI:
@Andrew23 said in I can't link the libusb library and change UI:
The only thing that I changed after that was the build directory and nothing else
Where is the build directory? Is it inside project directory?
No, it's outside. The project's directory is .../QtProjects/MyProject and the build directory is .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug.
-
@jsulm said in I can't link the libusb library and change UI:
@Andrew23 said in I can't link the libusb library and change UI:
The only thing that I changed after that was the build directory and nothing else
Where is the build directory? Is it inside project directory?
No, it's outside. The project's directory is .../QtProjects/MyProject and the build directory is .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug.
-
@Andrew23 Make sure you don't have stall
Makefile
or generatedui_xxx.h
files anywhere in your source or build folder.You problems sounds to 99% like that.
@aha_1980 said in I can't link the libusb library and change UI:
@Andrew23 Make sure you don't have stall
Makefile
or generatedui_xxx.h
files anywhere in your source or build folder.You problems sounds to 99% like that.
In my source folder ( .../QtProjects/MyProject ) I haven't any
Makefile
orui_xxx.h
, just my c++ and ui source files. But in the build folder ( .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug ) I have these files -
@aha_1980 said in I can't link the libusb library and change UI:
@Andrew23 Make sure you don't have stall
Makefile
or generatedui_xxx.h
files anywhere in your source or build folder.You problems sounds to 99% like that.
In my source folder ( .../QtProjects/MyProject ) I haven't any
Makefile
orui_xxx.h
, just my c++ and ui source files. But in the build folder ( .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug ) I have these filesThis post is deleted! -
@aha_1980 said in I can't link the libusb library and change UI:
@Andrew23 Make sure you don't have stall
Makefile
or generatedui_xxx.h
files anywhere in your source or build folder.You problems sounds to 99% like that.
In my source folder ( .../QtProjects/MyProject ) I haven't any
Makefile
orui_xxx.h
, just my c++ and ui source files. But in the build folder ( .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug ) I have these files -
@jsulm said in I can't link the libusb library and change UI:
@Andrew23 Is this the same build folder you used before you copied the project?
The original project's folders are
.../QtProjects/Test/MyOriginalProject
.../QtProjects/Test/build-MyOriginalProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
now my copied project folders are
.../QtProjects/MyProject/MyNewQtProject
.../QtProjects/MyProject/build-MyNewQtProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
When I created the original project the framework choose the build forlder by default. When I copied the project in the new folder I inherited that and I changed it.
-
@jsulm said in I can't link the libusb library and change UI:
@Andrew23 Is this the same build folder you used before you copied the project?
The original project's folders are
.../QtProjects/Test/MyOriginalProject
.../QtProjects/Test/build-MyOriginalProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
now my copied project folders are
.../QtProjects/MyProject/MyNewQtProject
.../QtProjects/MyProject/build-MyNewQtProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug
When I created the original project the framework choose the build forlder by default. When I copied the project in the new folder I inherited that and I changed it.
-
@aha_1980 said in I can't link the libusb library and change UI:
@Andrew23 Make sure you don't have stall
Makefile
or generatedui_xxx.h
files anywhere in your source or build folder.You problems sounds to 99% like that.
In my source folder ( .../QtProjects/MyProject ) I haven't any
Makefile
orui_xxx.h
, just my c++ and ui source files. But in the build folder ( .../QtProjects/build-MyProject-Desktop_Qt_5_15_2_MinGW_64_bit-Debug ) I have these files -
Close Qt Creator, delete the
.pro.user
file and the build folder, then open the project again and rebuild it.@aha_1980 said in I can't link the libusb library and change UI:
Close Qt Creator, delete the
.pro.user
file and the build folder, then open the project again and rebuild it.@J-Hilk said in I can't link the libusb library and change UI:
@Andrew23 also delete the .qmake.stash file
Thanks guys. I deleted the build folder (where is
.qmake.stash
) and the.pro.user
file in the source directory, and now I can modify my User Interface. But the other strange behaviour about the libusb library remains: if I modify my code I get the errorwarning: ignoring #pragma warning [-Wunknown-pragmas] warning: ignoring #pragma warning [-Wunknown-pragmas] warning: ignoring #pragma warning [-Wunknown-pragmas] error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
but if I rebuild again the project, it works without errors. So I get the error only the first build after a change. Now, I can live with it, but how I can fix it?
-
@aha_1980 said in I can't link the libusb library and change UI:
Close Qt Creator, delete the
.pro.user
file and the build folder, then open the project again and rebuild it.@J-Hilk said in I can't link the libusb library and change UI:
@Andrew23 also delete the .qmake.stash file
Thanks guys. I deleted the build folder (where is
.qmake.stash
) and the.pro.user
file in the source directory, and now I can modify my User Interface. But the other strange behaviour about the libusb library remains: if I modify my code I get the errorwarning: ignoring #pragma warning [-Wunknown-pragmas] warning: ignoring #pragma warning [-Wunknown-pragmas] warning: ignoring #pragma warning [-Wunknown-pragmas] error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
but if I rebuild again the project, it works without errors. So I get the error only the first build after a change. Now, I can live with it, but how I can fix it?
@Andrew23 said in I can't link the libusb library and change UI:
Hi @Andrew23,I think:
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]and
error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
are two different warnings.
Have you made sure that the libusb at the mentioned path has a compatible architecture (32 or 64 bit)?
Regards
-
@Andrew23 said in I can't link the libusb library and change UI:
Hi @Andrew23,I think:
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]and
error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
are two different warnings.
Have you made sure that the libusb at the mentioned path has a compatible architecture (32 or 64 bit)?
Regards
@aha_1980 said in I can't link the libusb library and change UI:
@Andrew23 said in I can't link the libusb library and change UI:
Hi @Andrew23,I think:
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]
warning: ignoring #pragma warning [-Wunknown-pragmas]and
error: skipping incompatible D:\Documenti\Qt\ProgettoAudiometro\Evometer/libusb-1.0.lib when searching for -llibusb-1.0
are two different warnings.
Have you made sure that the libusb at the mentioned path has a compatible architecture (32 or 64 bit)?
Regards
Yes @aha_1980 it was my mistake. I just updated the libusb files downloaded from their website and now all works fine. Thanks a lot.