qt 项目移植到vs 中遇到的问题和心得

将qt项目移动到vs中的原因:因为qt下程序崩溃原因不好查,但是vs下的dgbhelper 比较好用,所以耗时间移植过去,下面记录下移植过程遇到的问题。

1、qt下工程会同时包含cstdint 和stdint.h 两个文件。导致重定义错误,

<stdint.h> 第35行的代码

typedef signed char        int_fast8_t;
typedef int                int_fast16_t;
typedef int                int_fast32_t;
typedef long long          int_fast64_t;
typedef unsigned char      uint_fast8_t;
typedef unsigned int       uint_fast16_t;
typedef unsigned int       uint_fast32_t;
typedef unsigned long long uint_fast64_t;
--------------------------------------------------
<cstdint> 第60行的代码被注释掉
/*
typedef signed char int_fast8_t;
typedef unsigned char uint_fast8_t;
typedef short  int_fast16_t;
typedef unsigned short  uint_fast16_t;
typedef int  int_fast32_t;
typedef unsigned  int  uint_fast32_t;
*/

由上面的图可以看出,uint_fast16_t 被重复定义,所以会报重复定义的错误,修改方法,将cstdint 备份一份,把其中的重复的部分给注释掉。

2、qt 移植到vs后,提示中文错误,有换行符的错误,原因就是字符集不一样

解决方法,第一步

选择使用多字节字符集。从qt过来是unicode字符集

第二步:

 命令行里添加/utf-8 即可

第三步:运行结果如下图所示:

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值