VS2017编译cpp工程出现问题

  • 硬件型号:芯片版本 Cypress FX3 USB3014(和芯片无关))

重现步骤:

1.解压 FX3_SDK_Windows_v1.3.3.exe

2.VS2017编译自带demo

cd ./Cypress/EZ-USB FX3 SDK/1.3/application/cpp

3.以上demo是vc2008的工程,转换为vs2017的工程后

  1. 添加【SetupAPI.Lib】

    win10 SDK库,不需要指定地址,默认已经static link
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x86
1>cyapi.lib(CyAPI.obj) : error LNK2019: 无法解析的外部符号 sprintf,该符号在函数 "public: void __cdecl CCyUSBDevice::UsbdStatusString(unsigned long,char *)" (?UsbdStatusString@CCyUSBDevice@@QEAAXKPEAD@Z) 中被引用
1>.\x64\Release/bulkloop.exe : fatal error LNK1120: 1 个无法解析的外部命令

5.依然提示错误,还需要静态链接【legacy_stdio_definitions.lib】

  • #include <stdio.h> 无效
  • 静态链接【legacy_stdio_definitions.lib】 没有此lib文件
<stdio.h> and <conio.h>

    The printf and scanf family of functions are now defined inline. The definitions of all of the printf and scanf functions have been moved inline into <stdio.h>, <conio.h>, and other CRT headers. This is a breaking change that leads to a linker error (LNK2019, unresolved external symbol) for any programs that declared these functions locally without including the appropriate CRT headers. If possible, you should update the code to include the CRT headers (that is, add #include <stdio.h>) and the inline functions, but if you do not want to modify your code to include these header files, an alternative solution is to add an additional library to your linker input, legacy_stdio_definitions.lib.

    To add this library to your linker input in the IDE, open the context menu for the project node, choose Properties, then in the Project Properties dialog box, choose Linker, and edit the Linker Input to add legacy_stdio_definitions.lib to the semi-colon-separated list.

    If your project links with static libraries that were compiled with a release of Visual C++ earlier than 2015, the linker might report an unresolved external symbol. These errors might reference internal stdio definitions for _iob, _iob_func, or related imports for certain stdio functions in the form of _imp_*. Microsoft recommends that you recompile all static libraries with the latest version of the Visual C++ compiler and libraries when you upgrade a project. If the library is a third-party library for which source is not available, you should either request an updated binary from the third party or encapsulate your usage of that library into a separate DLL that you compile with the older version of the Visual C++ compiler and libraries.


参考网站:

有讨论过此问题

Cypress社区论坛1

Cypress社区论坛2

解决方案指向

msdn(英文版)

msdn(中文版)

https://blog.csdn.net/baidu_37503452/article/details/76235121

https://blog.csdn.net/wangzhichunnihao/article/details/78480493

==============

解决方案:

添加静态库(吐血写完C# 之后,才处理好这个问题,又要改成C++版本了)

添加【legacy_stdio_definitions.lib】VS2017运行库,
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\lib\x64\
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\lib\x86\ 添加【SetupAPI.Lib】 win10 SDK库(需要额外 安装win10 SDK) C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x86

Cypress USB3014 C++DLL 导入问题的更多相关文章

  1. DLL学习笔记一(DLL导入导出)

    创建DLL: 先声明导出函数:使用__declspec(dllexport) #include"DLLSample.h" #ifndef _DLL_SAMPLE_H #define ...

  2. Win32 的dll导入

    dll 文件可以导入变量,函数,和C++类,但是导入变量会使执行程序与dll紧耦合,而C++类导入则需要两个文件的开发商所用的编译器相兼容,所以做好只导入函数; 创建dll : 头文件:#ifdef  ...

  3. MinGW dll导入导出类

    dll不仅可以导入导出函数,还可以导入导出类.这篇文章就来介绍如何将类导入dll中并导出. 首先我们建立一个名为dll.cpp的文件(又是这种破名字),里面写上: #include <iostr ...

  4. dll导入导出宏定义,出现“不允许 dllimport 函数 的定义”的问题分析

    建立dll项目后,在头文件中,定义API宏 #ifndef API_S_H #define API_S_H ...... #ifndef DLL_S_20160424 #define API _dec ...

  5. dll导入导出资源文件查看工具 InspectExe

    InspectExe lets you explore and diagnose problems with Win32 applications. It is integrated directly ...

  6. C#语言-NPOI.dll导入Excel功能的实现

    前言:刚工作那会,公司有一套完善的MVC框架体系,每当有导入EXCEL功能要实现的时候,都会借用框架里自带的导入方法,一般三下五除二就完成了,快是快,可总是稀里糊涂的,心里很没有底.前几天,在另一个原 ...

  7. Cypress USB3014 controlEndPoint 使用事项

    control endpoint 发送,接收数据 返回fasle , lastError = 997, 抓包查看 Control Transfer (UP) XXXXXXXXX 1. Device: ...

  8. Unity基础-外部导入C# Dll(汇编集)

    外部导入C# Dll(汇编集) 使用创建一个dll工程 添加依赖的dll 导入Unity中,放入Assets的任意文件夹中 使用代码生成的dll汇编集只要"use dll的名字"引 ...

  9. Python调用C++的DLL

    import os import sys from ctypes import * test = cdll.LoadLibrary('D:\Python27\py.dll') print test.A ...

随机推荐

  1. 用VirtualBox和vagrant在win7&#215;64上搭建ruby on rails 开发环境

    下载准备 1.vagrant 官方  WINDOWS Universal (32 and 64-bit) http://www.vagrantup.com/downloads.html 2.Virtu ...

  2. Jquery实现loading效果

    需要引入jquery和bootstrap相关包,然后把下面的代码复制进去就可以了: <div class="modal fade" id="loadingModal ...

  3. Spring 拦截器——HandlerInterceptor

    采用Spring拦截器的方式进行业务处理.HandlerInterceptor拦截器常见的用途有: 1.日志记录:记录请求信息的日志,以便进行信息监控.信息统计.计算PV(Page View)等. 2 ...

  4. python学习-3.一些常用模块用法

    一.time.datetime 时间戳转化为元组 1 >>> time.localtime() 2 time.struct_time(tm_year=2016, tm_mon=8, ...

  5. Flex自定义组件开发

    一般情况下需要组件重写都是由于以下2个原因:1.在FLEX已有组件无法满足业务需求,或是需要更改其可视化外观等特性时,直接进行继承扩展.2.为了模块化设计或进一步重用,需要对FLEX组件进行组合.而F ...

  6. PAT 天梯赛 L2-009. 抢红包 【排序】

    题目链接 https://www.patest.cn/contests/gplt/L2-009 思路 用结构体存储,然后结构体排序 注意一下 个人编号是从 1 开始 计数的 AC代码 #include ...

  7. 牛客小白月赛1 H 写真がとどいています 【循环】

    题目链接 https://www.nowcoder.com/acm/contest/85/H 思路 如果熟悉 五线谱 才能做啊... 然后 先竖着遍历 再 横着 遍历 就可以了 AC代码 #inclu ...

  8. zookeeper学习与实战(一)环境部署

    [背景]:最近需要做这样一件事,在一台服务器上通过客户端生成配置文件,然后需要将该配置文件实时的传输到上百台应用服务器,供应用程序读取.同时,该配置文件是不定时更新内容,只要有更新,远程应用服务器应该 ...

  9. hd acm2025

    问题:平面上有n条折线,问这些折线最多能将平面分割成多少块? 思路:像这种平面被线段分割成几部分的问题,80%用递推解决,因为n条线段与(n-1)条线段能建立联系.   你可以作图观察一下,会发现新增 ...

  10. DB2常见错误

    +098 01568 动态SQL语句用分号结束+100 02000 没有找到满足SQL语句的行+110 01561 用DATA CAPTURE定义的表的更新操作不能发送到原来的子系统+111 0159 ...