Compilation error with a library file



  • Hello everyone,

    I am working on a project to communicate via USB with a Microchip microcontroller.
    I use Qt 5.2.1 (GCC 4.8.2, 32 bits) under ubuntu 14.04.
    I have download the sample source code from Microchip web site but when I want to compile it, I have two errors.

    bq. Connot find lHIDAPI
    collect2: error: ld returned 1 exit status

    I think I have a problem with a library file but I know how solve it. I am not an expert using the library file.

    If someone can help me the source code can be download here :
    "Microchip Library Application (MLA Linux version)":http://www.microchip.com/pagehandler/en-us/devtools/mla/home.html

    Moreover, there is a link to a guide :
    "Cros Platform custom HID demo...":http://ewh-bp-project.googlecode.com/hg-history/c35f016e9db74dbaf85acad23da43309738aaad9/trunk/PIC_code/BP USB code/PnP Demo - Cross Platform Software/Getting Started - Cross Platform Custom HID Demo.pdf

    Thank you for your help.



  • Assuming that you are trying to compile a native Linux Qt based program to talk via USB then you need to get your LIBS variable correct in your PRO file. It looks like you are missing a hyphen (-) before the "lHIDAPI" in LIBS. It is possible you are missing a -L option also. This is only a guess though.



  • I have found the solution, I have replace :
    @unix: !macx: LIBS += -L../HIDAPI/linux -lHIDAPI @

    by

    @unix:!macx: LIBS += -L$$PWD/../HIDAPI/linux/ -lHIDAPI

    INCLUDEPATH += $$PWD/../HIDAPI/linux
    DEPENDPATH += $$PWD/../HIDAPI/linux

    unix:!macx: PRE_TARGETDEPS += $$PWD/../HIDAPI/linux/libHIDAPI.a@


Log in to reply
 

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