MacBook上VSC无法打开源文件 "bits/stdc++.h"

2022/8/5 1:22:45

本文主要是介绍MacBook上VSC无法打开源文件 "bits/stdc++.h",对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

今天在VSC上碰到该问题,记录解决问题过程。

一、如何解决头文件找不到?

问题:检测到 #include 错误。请更新 includePath。已为此翻译单元(/Users/wangjiaqi/02-workspace/1.cpp)禁用波形曲线。

更新gcc --> 需要安装homebrew

<img src="https://user-images.githubusercontent.com/link-to-your-image.png" width="200" />

二、国内如何安装homebrew?

问题:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

常规脚本用这个:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  • 准备更新gcc,但是发现没有支持macOS10.13系统的gcc:(我早该想到,之前office在10.13也无法下载)
  • 准备重新安装10.15的系统。

三、gcc: the bottle needs the Apple Command Line Tools to be installed.错误?

  • 安装完之后:安装gcc仍然失败。(原因是 在从App Store上下载Xcode后,默认是不会安装Command Line Tools的。)
  • 在终端使用命令xcode-select --install来更新Xcode。

四、Error: Command failed with exit 128: git错误?

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

最后终于成功了。

参考来源

MacOS平台Clion不支持bits/stdc++.h头文件的解决方法

port 443: Connection refused

Homebrew国内如何自动安装(国内地址)(Mac & Linux)

Mac上安装gcc失败

Error: Command failed with exit 128: git

MAC下验证gcc是否安装成功

Mac重装Homebrew



这篇关于MacBook上VSC无法打开源文件 "bits/stdc++.h"的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程