Hi,
I want to use libusb in Qt Creator on linux mint.
I added libusb as external library.
in .pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test_libusb
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
unix:!macx: LIBS += -L$$PWD/../../../../../../usr/local/lib/ -lusb-1.0
INCLUDEPATH += $$PWD/../../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../../usr/local/include
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/lib/libusb-1.0.a
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test_libusb
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
unix:!macx: LIBS += -L$$PWD/../../../../../../usr/local/lib/ -lusb-1.0
INCLUDEPATH += $$PWD/../../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../../usr/local/include
unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/lib/libusb-1.0.a
To copy to clipboard, switch view to plain text mode
in main.cpp:
#include "mainwindow.h"
#include <QApplication>
#include <libusb-1.0/libusb.h>
int main(int argc, char *argv[])
{
MainWindow w;
libusb_context ctx;
libusb_init( &ctx );
w.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <libusb-1.0/libusb.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
libusb_context ctx;
libusb_init( &ctx );
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
but, when I compile project, I get error:
../test_libusb/main.cpp:10:20: error: aggregate 'libusb_context ctx' has incomplete type and cannot be defined
Can you help? Please.
Bookmarks