4 Replies Latest reply on Jul 14, 2017 11:08 AM by userc_43200

    Undefined reference to CyAPI functions


      I'm linking the static library CyAPI.lib in a Qt project with the following lines in the .pro file:


      unix|win32: LIBS += -L$$PWD/include/SpaMt/GrayskullMt/Cypress/ -lCyAPI
      INCLUDEPATH += $$PWD/include/SpaMt/GrayskullMt/Cypress
      DEPENDPATH += $$PWD/include/SpaMt/GrayskullMt/Cypress
      PRE_TARGETDEPS += $$PWD/include/SpaMt/GrayskullMt/Cypress/CyAPI.lib



      ...and I've included the CyAPI.h header file (in the same directory with the other related headers, CyUSB30_def.h, etc) in the source file of a new class and attempted to use several functions, like this:


      #include <SpaMt/GrayskullMt/Cypress/CyAPI.h>
      gsDevice = new CCyUSBDevice();
      if(gsDevice->DeviceCount() > 0)
      CCyUSBEndPoint *ep = gsDevice->EndPointOf(0x03);



      ...but I get an "Undefined reference to <function>" error each time I attempt to use any of the functions provided by CyAPI. This makes me think that the static library is not being linked, as I assume that's where all the functions are defined. However I don't see any qmake errors when it reads the .pro file or any compile-time errors related to the linking of the library. What's going on here? Why am I getting these undefined reference errors? Please help!


      As a side note, I had to include '#include <Windows.h>' to CyUSB30_def.h to have the various UCHAR, UINT, etc keywords recognized by the compiler. I thought it was strange this was left out, so maybe I'm breaking something here.