Undefined reference to CyAPI functions

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
FoHa_1559001
Level 1
Level 1

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

   

<code>
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

</code>

   

...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:

   

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

</code>

   

...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.

   

Thanks,

   

Forrest

0 Likes
4 Replies
FoHa_1559001
Level 1
Level 1

We found that the CyAPI lib was compiled with MSVC and so was not compatible with out Qt project using the MinGW compiler. We were able to find and use the source to recompile CyAPI with MinGW and this allowed us to successfully statically link it in our Qt project and verified that the library was functional. 

0 Likes
Anonymous
Not applicable

Hello, I have the exact same problem in here. Would you please send me the new .lib compatible with both Qt and MinGW ??

   

Thank you.  

0 Likes
lock attach
Attachments are accessible only for community members.
FoHa_1559001
Level 1
Level 1

Attached the lib files we are using with Qt and MinGW.

0 Likes
Anonymous
Not applicable

Thank you so much ! 

0 Likes