Question

I'm trying to install libusb (not libusb-win32) on windows 7. I have to link it with Qt 5.0.1. Here are the problems I'm facing

  • In the INSTALL file in the extracted libusb folder, it tells me to cd to the current folder then run ./configure make makeinstall But I got the error

'./configure' is not recognized as a valid command.

Googling this problem usually gives the solution as installing libusb-win32. However, I want to avoid that, as of now.

  • In the libusb library, there were a few MSVC projects, so I built them. That did generated some .lib files. So I proceeded to link them with my Qt project. It recognizes the libusb.h header file but does not link properly. Here is my .pro file

    QT       += core gui widgets
    
    TARGET = Qt_libusb TEMPLATE = app
    
    
    SOURCES += main.cpp\
        qt_libusb.cpp
    
    HEADERS  += qt_libusb.h
    
    FORMS    += qt_libusb.ui
    
    LIBS += -LC:\libusb-1.0.18\Win32\Debug\lib\libusb-1.0
    
    INCLUDEPATH += C:/libusb-1.0.18/libusb DEPENDPATH += C:/libusb-1.0.18/libusb
    

My objective is to link the libusb library with Qt. Please tell me if I haven't 'installed' the library correctly or if I am linking it in a wrong way. thanks

Was it helpful?

Solution

Your project file does not reference the library. You only provide a path where libraries might be found, but there's no reference to the libusb library itself.

What you're missing is something like

LIBS += -llibusb

You also can't have multiple project file statements on the same line. The below is an error:

TARGET = Qt_libusb TEMPLATE = app

It should look like:

TARGET = Qt_libusb 
TEMPLATE = app
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top