zoukankan      html  css  js  c++  java
  • Mac vscode配置c++环境

    只需在 include path 中加上c++所有*.h文件所在的目录即可,一般在 /Library/Developer/CommandLineTools/usr/include/ 目录下,若不在这个目录下,可以输入以下命令得到include path,然后再加入配置文件中。
    gcc -v -E -x c++ -

    但是mac自带的编译器clang里面并没有配置大家最爱的 bits/stdc++.h,我们可以进行配置,只需要在 /Library/Developer/CommandLineTools/usr/include/ 目录下,创建bits文件夹,并在该文件夹中创建 stdc++.h,然后在stdc++.h中引用c++中所有的*.h文件即可,下面是参考的 stdc++.h。

    注意上述操作需要sudo权限


    // C++ includes used for precompiling -*- C++ -*-
    
    // Copyright (C) 2003-2014 Free Software Foundation, Inc.
    //
    // This file is part of the GNU ISO C++ Library.  This library is free
    // software; you can redistribute it and/or modify it under the
    // terms of the GNU General Public License as published by the
    // Free Software Foundation; either version 3, or (at your option)
    // any later version.
    
    // This library is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    
    // Under Section 7 of GPL version 3, you are granted additional
    // permissions described in the GCC Runtime Library Exception, version
    // 3.1, as published by the Free Software Foundation.
    
    // You should have received a copy of the GNU General Public License and
    // a copy of the GCC Runtime Library Exception along with this program;
    // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    // <http://www.gnu.org/licenses/>.
    
    /** @file stdc++.h
     *  This is an implementation file for a precompiled header.
     */
    
    // 17.4.1.2 Headers
    
    // C
    #ifndef _GLIBCXX_NO_ASSERT
    #include <cassert>
    #endif
    #include <cctype>
    #include <cerrno>
    #include <cfloat>
    #include <ciso646>
    #include <climits>
    #include <clocale>
    #include <cmath>
    #include <csetjmp>
    #include <csignal>
    #include <cstdarg>
    #include <cstddef>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    
    #if __cplusplus >= 201103L
    #include <ccomplex>
    #include <cfenv>
    #include <cinttypes>
    #include <cstdbool>
    #include <cstdint>
    #include <ctgmath>
    #include <cwchar>
    #include <cwctype>
    #endif
    
    // C++
    #include <algorithm>
    #include <bitset>
    #include <complex>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #include <iostream>
    #include <istream>
    #include <iterator>
    #include <limits>
    #include <list>
    #include <locale>
    #include <map>
    #include <memory>
    #include <new>
    #include <numeric>
    #include <ostream>
    #include <queue>
    #include <set>
    #include <sstream>
    #include <stack>
    #include <stdexcept>
    #include <streambuf>
    #include <string>
    #include <typeinfo>
    #include <utility>
    #include <valarray>
    #include <vector>
    
    #if __cplusplus >= 201103L
    #include <array>
    #include <atomic>
    #include <chrono>
    #include <condition_variable>
    #include <forward_list>
    #include <future>
    #include <initializer_list>
    #include <mutex>
    #include <random>
    #include <ratio>
    #include <regex>
    #include <scoped_allocator>
    #include <system_error>
    #include <thread>
    #include <tuple>
    #include <typeindex>
    #include <type_traits>
    #include <unordered_map>
    #include <unordered_set>
    #endif
    
  • 相关阅读:
    C语言在32位和64位机器下数字数据类型的字节数取决于编译器和平台, 主要由编译器决定。
    [MySQL]表创建外键失败:ERROR 1005 (HY000): Can't create table (errno: 150)
    将Windows下磁盘出现黑色为分配区域变成绿色区域
    [git更新中]版本控制工具git初步使用
    [Python]python CGI脚本在apache服务器上运行时出现“Premature end of script headers”错误
    [MySQL]修改mysql数据库的root密码的方法
    网页表单中的汉字存储到数据库, 再从数据库中提取并显示到网页时碰到的乱码问题。
    将chrome浏览器的默认背景颜色修改为浅绿色,以减缓长时间看电脑的眼睛不舒服的问题
    获取百度音乐盒里歌曲的外部链接。
    [Apache]架设Apache服务器
  • 原文地址:https://www.cnblogs.com/Yuzao/p/15108972.html
Copyright © 2011-2022 走看看