CyAPI.lib引用报错

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

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

cross mob
JoFe_4593541
Level 1
Level 1
First question asked First reply posted

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

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

运行时错误如下:

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.

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

0 点赞
1 解答
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi,

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

pastedImage_0.png

在原帖中查看解决方案

0 点赞
2 回复数
JoFe_4593541
Level 1
Level 1
First question asked First reply posted

调试环境配置为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 ==========

0 点赞
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hi,

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

pastedImage_0.png

0 点赞