【问题标题】:Build errors in Visual StudioVisual Studio 中的构建错误
【发布时间】:2022-01-24 23:46:37
【问题描述】:

最近,我想开发一个简单的应用程序,我开始使用 Visual Studio。因此,我不熟悉它。我从一个简单的“Hello World”代码开始,这是默认代码。但是,发生构建错误,系统说找不到指定的文件。我不知道如何解决它们。下面是错误代码:

1>------ Build started: Project: test, Configuration: Debug x64 ------
1>test.cpp
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
1>Done building project "test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

提前感谢您的帮助!!

编辑:

编辑 2:

【问题讨论】:

  • 确保在安装 vs 时安装了 Windows sdk,并且您的项目设置设置为使用已安装的 sdk 版本
  • @AlanBirtles 感谢您的建议。我对 Visual Studio 中的设置不太熟悉。因此,我不知道我是否做得正确。请检查我上面上传的图片。
  • 这篇文章是同一个问题(虽然源头不同):stackoverflow.com/questions/12685202/how-do-i-get-crtdbg-h-file - 我知道您安装了 Windows SDK,但您可能需要执行其他步骤,例如只需重新启动计算机例如,您的环境变量已更新。
  • @Dai 我已经重新启动了我的计算机,但似乎仍然会发生构建错误。
  • 您在创建项目/解决方案后是否安装了 Windows SDK?

标签: c++ visual-studio build-error


【解决方案1】:

当我在我的 3 台运行 Windows 10 的计算机上安装 Visual Studio 2022 时遇到了这个问题(我想知道我是否只是我的主 PC 在运行),但我的新 Windows 11 PC 运行良好。 经过大量修改后,我发现如果我从 Visual Studio 安装程序中删除了 Windows 10 SDK,然后直接安装它(从独立下载器而不是通过 Visual Studio),重新启动后一切正常!

【讨论】:

  • 谢谢你告诉我。有时间我会试试的。
猜你喜欢
  • 2018-12-03
  • 2021-04-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-20
  • 2014-12-24
  • 2017-12-05
相关资源
最近更新 更多