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

相关推荐
脚踏实地皮皮晨11 小时前
003003001_Grid控件
开发语言·windows·算法·c#·visual studio
脚踏实地皮皮晨17 小时前
003003002_WPF Grid 基类官方类定义逐行深度解析
开发语言·windows·算法·c#·wpf·visual studio
zyl837211 天前
MCP CodeGraph 完整介绍
visual studio
脚踏实地皮皮晨1 天前
002002002_DepandencyObject类2
开发语言·windows·算法·c#·visual studio
仙宇觉尘2 天前
【译】Visual Studio Copilot 中更智能的人工智能编辑
人工智能·copilot·visual studio
计算机内卷的N天2 天前
CMake与Visual Studio的使用
c++·ide·visual studio
脚踏实地皮皮晨2 天前
003002004_WPF Panel 基类 官方类定义
开发语言·windows·算法·c#·wpf·visual studio
咱入行浅2 天前
一款实用的 Visual Studio 发布部署插件,助力提高部署效率!
ide·visual studio
呐抹倾2 天前
【译】Visual Studio 停用:针对旧版本 Visual Studio 的支持提醒
ide·visual studio
Listen·Rain4 天前
用AI开发出一个AI
java·人工智能·spring boot·tomcat·intellij-idea·mybatis·visual studio