1

我昨天更新到 macOS monterey,从那以后我的 vs 代码没有编译任何代码。它抛出这些错误:

#include errors detected. Please update your includePath. Squiggles are 
disabled for this translation unit (/Users/ishudhariwal/contest.cpp).

cannot open source file "endian.h" (dependency of "iostream")

它在 BigSur 上运行良好。我是编程的初学者。我无法弄清楚出了什么问题以及如何解决它。

4

3 回答 3

3

几天前,我在 Monterey 上更新了我的 MacBook M1 后,我遇到了和你完全相同的问题。坦率地说,我并没有详细介绍这种情况,但在找出这种行为的原因后,它变得很清楚,包括文件stdio.h和其他奇迹般地消失了。所以最后,终端中的一个命令帮助 -

xcode-select --install

我希望它能帮助你解决问题。

于 2021-11-05T01:22:52.747 回答
0

如果您使用 Microsoft 的 C/C++ 包,您需要更新位于生成的 .vscode 文件夹中的 c_cpp_properties.json 文件。将此添加到您的 MacFrameworkPath:

"macFrameworkPath": [
     "/Library/Developer/**"            
],
``` This will include all the files you need from /Library/Developer. The ** looks through every folder inside that and on.
于 2021-10-30T04:00:13.427 回答
-1

尝试安装 Xcode 命令行工具。这很可能会解决问题。

试试下面的。

  1. 转到https://developer.apple.com/download/all/
  2. 登录或注册
  3. 在下载列表中查找:“Xcode 13.x 命令行工具”,然后单击 dmg 并下载。
  4. 安装它。
于 2021-11-01T19:05:33.127 回答