VC6移植VS2017记录

1

typedef void * POINTER_64 PVOID64;

windows kits\10\include\10.0.16299.0\um\winnt.h(390): error C2146:语法错误: 缺少“;”(在标识符“PVOID64”的前面)

原因
winnt.h包含了#include <basetsd.h>
添加directx 9.0c的头文件以后,directx9的头文件也包含了<basetsd.h>,造成引用冲突,调整include包含顺序(directx9包含文件放在最后)

2

template < typename _T >std::ostream &operator <<( std::ostream &o, typename _UserDataType<_T>::This_Reference V )

1>e:\coding\vs2017\fxlib2017\userdata.h(126): note:用“typename”为前缀来表示类型

原因
vs2017标准无法获知模板类是类型还是变量,需要显式指定typename关键词,表示模板类是一个类型

template < typename _T >std::ostream &operator <<( std::ostream &o, _UserDataType<_T>::This_Reference V )
//
// 修改为
//
template < typename _T >std::ostream &operator <<( std::ostream &o, typename _UserDataType<_T>::This_Reference V )

3

class bad_new : public exception

1>e:\coding\vs2017\fxlib2017\err.h(19): error C2504: “exception”:未定义基类

原因
缺少模板类命名空间std,引入命名空间

using namespace std;

4

template < typename T >SAFE_RELEASE( T *&p )

1>e:\coding\vs2017\fxlib2017\main.h(141): error C4430: 缺少类型说明符 - 假定为int。注意: C++ 不支持默认 int

原因
缺少返回值,vs2017标准需要显示定义返回值类型(vc6标准假定函数返回类型为int)

template < typename T >SAFE_RELEASE( T *&p )
//
//修改为
//
template < typename T >void SAFE_RELEASE( T *&p )

5

sprintf(str, "CALL WINAPI[%s] ERROR[%d]", winapi, GetLastError());

1>e:\coding\vs2017\fxlib2017\main.h(164): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

原因
字面意思sprintf_s线程安全函数版本代替sprintf

sprintf(str, "CALL WINAPI[%s] ERROR[%d]", winapi, GetLastError());
//
//修改为
//
sprintf_s(str, "CALL WINAPI[%s] ERROR[%d]", winapi, GetLastError());

6

bool _ClassRegister::_compare_name( const string &s1, const string &s2 )
{int n1 = s1.length() ;

1>e:\coding\vs2017\fxlib2017\class.h(128): warning C4267: “初始化”:从“size_t”转换到“int”,可能丢失数据

原因
字面意思,64位操作系统下size_t并不一定是int类型

int n1 = s1.length() ;
//
//修改为
//
size_t n1 = s1.length() ;

7

  void *operator new( size_t size ) throw(bad_new) ;

1>e:\coding\vs2017\fxlib2017\class.h(251): warning C4290: 忽略 C++ 异常规范,但指示函数不是 __declspec(nothrow)

原因
vs2017不支持异常抛出指示,可以通过disable禁止警告(不解决问题)

#pragma warning( disable : 4290 )

8

template < typename _T >_Vector2<_T>::_Vector2<_T>()

1>e:\coding\vs2017\fxlib2017\tvector.h(46): warning C4812: 过时的声明样式:请改用“_Vector2<_T>::_Vector2”

原因
语法调整,模板函数的构造函数不需要加模板声明

template < typename _T >_Vector2<_T>::_Vector2<_T>()
//
//修改为
//
template < typename _T >_Vector2<_T>::_Vector2()

9

PROPERTY(CFloatRect *, "tutv", _PropertyGetTextureRect, _PropertySetTextureRect, CVariant::VT_CLASS)

1>e:\coding\vs2017\fxlib2017\2dgridrender.cpp(145): error C4867: “C2DGridRender::_PropertyGetTextureRect”: 非标准语法;请使用 “&” 来创建指向成员的指针

原因
需要用&符号取函数地址

PROPERTY(CFloatRect *, "tutv", _PropertyGetTextureRect, _PropertySetTextureRect, CVariant::VT_CLASS)
//
//修改为
//
PROPERTY(CFloatRect *, "tutv", &_PropertyGetTextureRect, &_PropertySetTextureRect, CVariant::VT_CLASS)

10

Int CTimer::GetBeginTime() const
{ return m_nBeginTime ;

1>e:\coding\vs2017\fxlib2017\timer.h(80): warning C4927:转换非法;隐式应用了多个用户定义的转换

原因
自定义类型UInt到自定义类型Int经过了两次隐式转化(UInt->int->Int),vs2017标准不允许多次隐式转化

UInt  m_nBeginTime ;
//
//修改为
//
Int  m_nBeginTime ;

11

itoa( uValue, _buf, 10 )

1>e:\coding\vs2017\fxlib2017\window.cpp(344): warning C4996: ‘itoa’:The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _itoa. See online help for details.

原因
itoa替换为线程安全_itoa_s版本,注意_itoa_s不在返回char *

itoa( uValue, _buf, 10 ) ;
//
//修改为
//
_itoa_s( uValue, _buf, 10 ) ;

12

  __asm{

1>e:\coding\vs2017\fxlib2017\cpuinfo.cpp(32): error C4235: 使用了非标准扩展:不支持在此结构上使用“__asm”关键字

原因
vs 64位编译器不支持内联汇编函数
解决方法
1、安装intel编译器( Intel C++ Compiler XE)替代vs编辑器,但有可能会有其他意想不到问题
2、用外联汇编文件
a.新建.asm文件
b.引入汇编编译器(项目->右键->生成依赖项->生成自定义…)
c.定义.asm文件编译器(asm文件->右键->属性)

13

  wcscpy( pInfo->achName, m_szName ) ;

1>e:\coding\vs2017\fxlib2017\d3drenderinputpin.cpp(369): warning C4996: ‘wcscpy’: This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

原因
用wcscpy_s线程安全版函数替代wcscpy

  wcscpy( pInfo->achName, m_szName ) ;
//
//修改为
//wcscpy_s( pInfo->achName, m_szName ) ;

14

freopen("conout$","w",stdout);
freopen("conout$","w",stderr);

1>e:\coding\vs2017\xplayer2017\xplayerapp.cpp(256): warning C4996: ‘freopen’: This function or variable may be unsafe. Consider using freopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

原因
用freopen_s线程安全版函数替代freopen,注意,freopen_s增加了一个参数

freopen("conout$","w",stdout);
freopen("conout$","w",stderr);
//
//修改为
//
FILE *os, * es;
freopen_s(&os, "conout$","w", stdout);
freopen_s(&es, "conout$", "w", stderr);

15

char *s = new char[ len + 1 ];
strcpy( s, timeString );

1>e:\coding\vs2017\xplayer2017\osc\oscprintreceivedelements.cpp(120): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

原因
用strcpy_s线程安全版函数替代strcpy,注意,strcpy_s增加了一个参数

size_t len = strlen( timeString );
char *s = new char[ len + 1 ];
strcpy( s, timeString );
//
//修改为
//
size_t len = strlen( timeString );
char *s = new char[ len + 1 ];
strcpy_s( s, len + 1, timeString );

16

time_t t = (unsigned long)( arg.AsTimeTagUnchecked() >> 32 );
const char *timeString = ctime( &t );

1>e:\coding\vs2017\xplayer2017\osc\oscprintreceivedelements.cpp(117): warning C4996: ‘ctime’: This function or variable may be unsafe. Consider using ctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

原因
用ctime_s线程安全版函数替代ctime,注意,ctime_s增加了二个参数

time_t t = (unsigned long)( arg.AsTimeTagUnchecked() >> 32 );
const char *timeString = ctime( &t );
//
//修改为
//
time_t t = unsigned long)( arg.AsTimeTagUnchecked() >> 32 );
enum { len = 128};
char timeString[len] = { 0 };
ctime_s(timeString, len, &t);

17

链接错误

错误 LNK2001 无法解析的外部符号 “class std::basic_ostream<char,struct std::char_traits & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits > &,class _UserDataType &)” (??6@YAAEAV?basicostream@DU?basic_ostream@DU?basico​stream@DU?char_traits@D@std@@@std@@AEAV01@AEAV?$_UserDataType@H@@@Z) XPlayer E:\CODING\VS2017\XPlayer2017\fxlibd.lib(SyncTimerWnd.obj)

原因
operator模板重载函数定义和friend友元函数声明格式不一致造成的,友元函数申明要与operator重载函数一样

  friend std::ostream & operator <<( std::ostream &o, _UserDataType<_T> &V ) ;friend std::istream & operator >>( std::istream &i, _UserDataType<_T> &V ) ;
} ;
template < typename _T >std::ostream &operator <<( std::ostream &o, _UserDataType<_T> &V ){o << V._v ;return o ;}
template < typename _T >std::istream &operator >>( std::istream &i, _UserDataType<_T> &V ){i >> V._v ;return i ;}
//
//修改为
//
template < typename _T >friend std::ostream & operator <<( std::ostream &o, _UserDataType<_T> &V ) ;
template < typename _T >friend std::istream & operator >>( std::istream &i, _UserDataType<_T> &V ) ;
} ;
template < typename _T >std::ostream &operator <<( std::ostream &o, _UserDataType<_T> &V ){o << V._v ;return o ;}
template < typename _T >std::istream &operator >>( std::istream &i, _UserDataType<_T> &V ){i >> V._v ;return i ;}

VC6移植VS2017记录相关推荐

  1. 基于全志A33开发板linux系统移植学习记录(Boot0)

    基于全志A33开发板linux系统移植学习记录 第一章 Boot0基于ARMGCC的编译与修改 文章目录 基于全志A33开发板linux系统移植学习记录 前言 一.全志A33简介以及上电引导流程 二. ...

  2. selinux移植调试记录

    LINUX平台selinux移植调试记录 前言 什么是selinux 主要作用 selinux的组成 工作模式 工作流程 查看当前的文件或进程的安全上下文 uboot和kernel中的配置 refpo ...

  3. 【嵌入式】MCU(HC32F460)+SPI接口LCD液晶屏ILI9341 移植emWin记录1----点亮LCD屏

    目录 一 SPI屏的接线 二 SPI屏驱动初始化 三 SPI屏点亮 四 附录 一 SPI屏的接线 SPI屏的特点在于接线简单,只需要四根SPI线以及几个GPIO口即可驱动工作,但是由于非并口的,所以当 ...

  4. u-boot移植问题记录(一)--U_BOOT_CMD区别

    2019独角兽企业重金招聘Python工程师标准>>> 我使用的是最新的u-boot版本(2013-10-rc3),你想下载的话可以去u-boot官网下载(http://www.de ...

  5. RTL8821CS移植过程记录

    RK3308B+RTL8821CS移植 在rk3308b平台移植rtl8821cs,rlt8821cs是wifi+bt一体的模组,主要记录下移植过程中需要注意的地方 移植驱动 将rtl8821cs的驱 ...

  6. 【从0到1】GD32F450+LAN8720+LWIP(裸机)移植过程记录

    参考资料 (1)<Lwip应用开发实战指南--基于STM32> (2)<STM32库开发实战指南--基于野火挑战者开发板> (3)<GD32F4xx_User_Manua ...

  7. PIBOT移植ROS2记录(2)-添加Node与cmd_vel

    前文添加了简单的测试保证编译通过,本文将开始移植实现一个控制下发 1. base_driver的移植 首先把base_driver.cpp添加到pibot_driver中编译 diff --git a ...

  8. Freemodbus 移植过程记录

    前言 Freemodbus 是一个协议栈:纯代码,按照一定逻辑性实现: 比如串口,用它来收发二进制数据,人们就制定一种规则(数据帧)来达到高效稳定的数据串数目的.再详细的内容可以自行网上检索一下相关介 ...

  9. 龙尚4g模块U9300C在rk3368移植适配记录

    一.模块连接         4g模块在系统中的连接:(4g模块是以usb外设的形式进行操作的) 二.调试移植过程   1.准备工作  ①驱动加入VID和PID 根据模块产品型号在 kernel/dr ...

最新文章

  1. java正则hitend,Java Matcher hitEnd()用法及代码示例
  2. wpf加载上千张图片部分图片不显示_开源WPF控件库MaterialDesignInXAML推荐
  3. 充分利用Microsoft Planner的6种方法
  4. 什么时候需要使用cqrs_在CQRS读取模型中使用Hibernate进行快速开发
  5. @async 如何返回list_图解 Await 和 Async
  6. JVM老年代垃圾收集器Serial Old和Parallel Old
  7. [转载] 卷积神经网络做mnist数据集识别
  8. JavaWeb--HttpSession案例
  9. tcp压测工具_掌门全链路灰度压测实战
  10. qt QDir 枚举类型
  11. iPhone手机弹窗BUG!每两分钟弹窗提醒一次,解决方案在这里
  12. 任正非:战略思想家的典范
  13. 外键的约束(Mysql、PostgreSQL)
  14. Bilibili的SWOT竞争力分析
  15. 办理芯片银行卡时记得把“闪付”功能取消
  16. 体系结构笔记------动态调度中的Tomasulo算法
  17. 计算机组成原理课程设计_微程序控制的运算器设计
  18. NDK篇 - JNI NDK 初探
  19. PHP:【商城后台管理系统】部署角色管理,角色添加,菜单权限,删除角色功能
  20. Automatic Targetless Extrinsic Calibration of a 3D Lidar 翻译

热门文章

  1. EEA演变及发展趋势
  2. table 固定表格宽度,设置列宽,超出内容省略号显示
  3. Vuex中浏览器安装devtools
  4. 苹果成功秘诀:十大关键因素导致与众不同(转)
  5. 读书 | 人机共生:智能时代人类胜出的5大策略
  6. 程序员搞笑对联_程序员专属对联
  7. Linux输入cd按回车,linux cd命令
  8. SQL总结(二)连表查询
  9. 施耐德电气参与制定《数据中心供配电设计标准》
  10. 【100%通过率】华为OD机试真题 JS 实现【最差产品奖】【2023 Q1 | 200分】