I have aproblem to integrate the Libusb for Android



  • I have wrote a test App because i can not integrate the libusb, the code is the following:
    Any suggestion?
    i have this error @/home/unix/MyCODE/QT_Creator/App_Android/mainwindow.cpp:20: error: undefined reference to 'libusb_init'@

    mainwindow.h
    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include "stdio.h"
    #include <libusb.h>

    #define stderr (&__sF[2])

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private slots:
    void on_pushButton_clicked();

    private:
    Ui::MainWindow *ui;
    };

    #endif // MAINWINDOW_H
    @
    mainwindow.cpp
    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_pushButton_clicked()
    {
    libusb_context *ctx;

    libusb_init(&ctx);
    int i=1;
    fprintf(stderr, "Failed to submit transfer %i!\n", i);
    

    }
    @

    .pro file
    @#-------------------------------------------------

    Project created by QtCreator 2015-02-16T10:18:44

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = App_Android
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    CONFIG += mobility

    INCLUDEPATH += /home/unix/Downloads/libusb-master/libusb

    LIBS += -L/home/unix/Downloads/libusb-master/android/libs/x86
    -lusb1.0
    @



  • Did you succeed in this? I am having the same problem


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.