2 Replies Latest reply on Apr 10, 2020 12:22 AM by YiZ_31

    CyAPI.lib引用报错

    JoFe_4593541

      用Visual Studio 2008按照,按照《Cypress USBSuite Application Development Guide》Version 1.2.3.20的说明2.2的步骤建立工程。运行后报错如下,以下图片是相关的配置。

       

       

       

       

       

      运行时错误如下:

      1>------ Build started: Project: TEST2, Configuration: Debug Win32 ------

      1>Linking...

      1>TEST2.obj : error LNK2028: unresolved token (0A000021) "public: __thiscall CCyUSBDevice::CCyUSBDevice(void *,struct _GUID,int)" (??0CCyUSBDevice@@$$FQAE@PAXU_GUID@@H@Z) referenced in function "public: __clrcall TEST2::Form1::Form1(void)" (??0Form1@TEST2@@$$FQ$AAM@XZ)

      1>TEST2.obj : error LNK2019: unresolved external symbol "public: __thiscall CCyUSBDevice::CCyUSBDevice(void *,struct _GUID,int)" (??0CCyUSBDevice@@$$FQAE@PAXU_GUID@@H@Z) referenced in function "public: __clrcall TEST2::Form1::Form1(void)" (??0Form1@TEST2@@$$FQ$AAM@XZ)

      1>C:\Users\Johnf_coputer\TEST2\Debug\TEST2.exe : fatal error LNK1120: 2 unresolved externals

      1>Build log was saved at "file://c:\Users\Johnf_coputer\TEST2\TEST2\Debug\BuildLog.htm"

      1>TEST2 - 3 error(s), 0 warning(s)

      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

       

       

      有以下疑问:

      1、添加CyAPI.lib时,提示第一张图所,不知道用不用配置"build rule";

      2、选择的CyAPI.lib示用X86还是X64,电脑用的是64位。   VS2008配置的是Debug, win32.

       

       

      目前不知道问题出在哪里。期望得到回复。谢谢!

        • 1. Re: CyAPI.lib引用报错
          JoFe_4593541

          调试环境配置为release后,错误如下

           

           

          1>------ Build started: Project: TEST2, Configuration: Release Win32 ------

          1>Linking...

          1>CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __imp__SetupDiDestroyDeviceInfoList@4

          1>CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __imp__SetupDiEnumDeviceInterfaces@20

          1>CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsA@16

          1>CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __imp__SetupDiGetDeviceInterfaceDetailA@24

          1>C:\Users\Johnf_coputer\TEST2\Release\TEST2.exe : fatal error LNK1120: 4 unresolved externals

          1>Build log was saved at "file://c:\Users\Johnf_coputer\TEST2\TEST2\Release\BuildLog.htm"

          1>TEST2 - 5 error(s), 0 warning(s)

          ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

          • 2. Re: CyAPI.lib引用报错
            YiZ_31

            Hi,

             

            你的CyAPI.lib没有被正确引用。参考我们example的引用方式: