当前位置:网站首页>Visual Studio上一些Error的解决方案
Visual Studio上一些Error的解决方案
2022-08-11 05:16:00 【FussyCat】
近期在迁移一个linux上下项目到windows,编译时出来一堆error,挑了一些做记录。
目录
1、E1696无法打开源文件 unistd.h
无法打开源文件 <unistd.h>
无法打开 源 文件 “unistd.h” 
【解决方案】
方案1:将<unistd.h>改为 “unistd.h”
结果:无效
方案2:视图-属性页-预处理器-预处理器定义,只保留“WIN32”,如图:
结果:无效
【方案3】头文件引入用宏隔离
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
【结果】有效
2、E0020 未定义标识符 “getcwd”

【方案】先了解下 getcwd 的使说明,从Microsoft官网上看,是方法弃用了,改为_getcwd.
官网链接
【方案】用宏隔离,重定义
#ifdef _WIN32
#define getcwd _getcwd
#endif
3、E0020 未定义标识符 “strcasecmp”

【方案】用宏隔离,重定义
#ifdef _WIN32
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif
4、E0020 未定义标识符 “F_OK”

【方案】直接宏定义赋0
#define F_OK 0
5、E0135 namespace “std” 没有成员 “cerr”

【方案】24行注释掉/删除
6、E0135 namespace “std” 没有成员 “string_view”

【方案】查一下string_view的使用说明,是c++17的特性,编译依赖c++17即可。
官网链接

7、C2065 “ssize_t”: 未声明的标识符

【方案】宏隔离,重定义
#ifdef _WIN32
#define ssize_t size_t;
#endif
边栏推荐
猜你喜欢

【win10+cuda7.5+cudnn6.0安装caffe①】安装cuda和cudnn

Flask框架学习:模板渲染与Get,Post请求
![[Embedded open source library] The use of MultiButton, an easy-to-use event-driven button driver module](/img/7b/e265305df01eb405a131d0de2154d3.png)
[Embedded open source library] The use of MultiButton, an easy-to-use event-driven button driver module

pip 国内源下载

tensorflow代码翻译成pytorch代码 -详细教程+案例

(一)Docker安装Redis实战(一主二从三哨兵)

redis分布式锁

task06 PyTorch生态

Linux中安装redis

redis集群模式--解决redis单点故障
随机推荐
深入理解线程、进程、多线程、线程池
Map根据key值排序
arraylist之与linkedlist
Configure checkstyle in IDEA
pytorch安装笔记——Pytorch在conda+CUDA10.2环境安装task01
批量修改数据库等视频文件名称
oracle tablespace and user creation
函数怎么用
You must understand - the nine built-in objects and four domain objects of JSP
Flask framework learning: template inheritance
flaks framework learning: adding variables to the URL
Decryption of BitLocker
吃瓜教程task02 第3章 线性模型
(3) Construction of a real-time performance monitoring platform (Grafana+Prometheus+Node_explorer+Jmeter)
Tips to make your code more and more taller and taller - code specification, you have to know
Flask framework learning: trailing slashes for routes
JedisLock_Redis分布式锁实现_转载
性能效率测试
(3) How Redis performs stress testing
Win10远程连接(实现多用户同时连接)