Visual Studio 2022 出现:E1696无法打开 源 文件 “stdafx.h“;E0020未定义标识符 “_TCHAR“错误解决办法

今天在用自己电脑上的visual studio2022写并行计算实验报告时出现了这种错误,但我在机房电脑vs2010版本运行时没有任何问题,于是我在网上找了解决办法,现总结如下。

1.报错E1696无法打开 源 文件 "stdafx.h",解决办法:

其实就是2022版本将 "stdafx.h" 写进预编译头里了,我们在写的时候就不用重复写了,直接将程序里的 "stdafx.h" 删除就好。

2.对于 " 未定义标识符 " printf " " 错误

添加头文件 "include<stdio.h>"

3.对于 " 未定义标识符 "_TCHAR" " 错误

添加语句" include<tchar.h> "

4.这时直接点击 " 开始执行(不调试)"可以正常运行,但结果可能达不到并行的效果。详细配置见链接。

相关推荐
脚踏实地皮皮晨1 天前
003006001_WrapPanel控件
开发语言·c#·.net·wpf·visual studio
霍霍的袁1 天前
【C++】模板从入门到进阶(函数模板 + 类模板 + 特化 + 分离编译)
开发语言·c++·visual studio
脚踏实地皮皮晨1 天前
003005002_WPF StackPanel 基类官方类定义逐行深度解析
开发语言·windows·算法·c#·wpf·visual studio
霍霍的袁2 天前
【C++】string类 从 入门使用 到 底层深浅拷贝模拟实现
开发语言·c++·visual studio
脚踏实地皮皮晨2 天前
003004002_UniformGrid控件的使用方法
开发语言·c#·.net·wpf·visual studio
脚踏实地皮皮晨2 天前
003003001_Grid控件
开发语言·windows·算法·c#·visual studio
脚踏实地皮皮晨3 天前
003003002_WPF Grid 基类官方类定义逐行深度解析
开发语言·windows·算法·c#·wpf·visual studio
zyl837213 天前
MCP CodeGraph 完整介绍
visual studio
脚踏实地皮皮晨3 天前
002002002_DepandencyObject类2
开发语言·windows·算法·c#·visual studio
仙宇觉尘4 天前
【译】Visual Studio Copilot 中更智能的人工智能编辑
人工智能·copilot·visual studio