Using Cypress USB Library CyAPI.dll[solved]



  • Hello all,

    I have been trying to use the library CyAPI.lib provided by Cypress USB Suite 3.4.7

    I put the .lib file in the lib/ folder in the project directory

    It comes with the CyAPI.h header file which is located in the inc/ folder

    My project file looks like this (generated by Qt)

    @
    #Add CyAPI lib
    win32: LIBS += -L$$PWD/lib/ -lCyAPI
    INCLUDEPATH += $$PWD/inc
    DEPENDPATH += $$PWD/inc
    @

    When I compiled it, this is the error:

    @
    mainwindow.obj : error LNK2019: unresolved external symbol "public: __thiscall CCyUSBDevice::~CCyUSBDevice(void)" (??1CCyUSBDevice@@QAE@XZ) referenced in function "public: void __thiscall MainWindow::USB_Init(void)" (?USB_Init@MainWindow@@QAEXXZ)
    mainwindow.obj : error LNK2019: unresolved external symbol "public: unsigned char __thiscall CCyUSBDevice::DeviceCount(void)" (?DeviceCount@CCyUSBDevice@@QAEEXZ) referenced in function "public: void __thiscall MainWindow::USB_Init(void)" (?USB_Init@MainWindow@@QAEXXZ)
    mainwindow.obj : error LNK2019: unresolved external symbol "public: __thiscall CCyUSBDevice::CCyUSBDevice(void *,struct _GUID,int)" (??0CCyUSBDevice@@QAE@PAXU_GUID@@H@Z) referenced in function "public: void __thiscall MainWindow::USB_Init(void)" (?USB_Init@MainWindow@@QAEXXZ)
    debug\qtproj.exe : fatal error LNK1120: 3 unresolved externals
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x460'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
    Stop.
    @

    It looks like the lib failed to link. Can someone help me understand why it doesn't link? Is it the library's problem or something failed in the linking process

    I am using Qt5.0.0 by the way, compiled with default parameters

    Thanks!


  • Lifetime Qt Champion

    Hi,

    Does you Qt and CyAPI dll use the same architecture ?



  • Hi SGalst

    Thanks for the help. I somehow copied the x64 lib into my project directory. with the x86 version, it works now!

    Thanks!


  • Lifetime Qt Champion

    You're welcome !

    Since you got it working, don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)



  • [quote author="aobo" date="1379296197"]Hi SGalst

    Thanks for the help. I somehow copied the x64 lib into my project directory. with the x86 version, it works now!

    Thanks![/quote]

    Hi aobo, which x64 lib do you copy into project? Is user32.lib?
    Should I create lib/ folder and inc/folder and put in CyAPI.lib and CyAPI.h?
    Thanks!



  • Hi.

    Good to see someone else is using this library to do things!

    If you have installed the Cypress USB Suite 3.4.7. There are files in C:/Cypress/Cypress Suite USB 3.4.7/CyAPI

    You want the CyAPI.lib in the lib/x86/ folder (I used the one from x64, which created the problem). Put this in your Qt project directory lib/ then grab all the header files in C:\Cypress\Cypress Suite USB 3.4.7\CyAPI\inc and put them in your project directory inc/ folder

    You can then use the code here to link the library to your project:

    @
    #Add CyAPI lib
    win32: LIBS += -L$$PWD/lib/ -lCyAPI
    INCLUDEPATH += $$PWD/inc
    DEPENDPATH += $$PWD/inc
    @

    Make sure when you use the library, include <Windows.h> because CyAPI uses a lot of the windows definitions.


Log in to reply
 

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