首页 > 编程语言 >macOS下使用bits/stdc++.h万能头文件

macOS下使用bits/stdc++.h万能头文件

时间:2024-06-01 16:34:29浏览次数:16  
标签:std macOS 头文件 usr c++ Library include CommandLineTools Developer

 

macOS下使用bits/stdc++.h万能头文件

1.

终端中输入

echo | g++ -v -x c++ -E -
#include <...> search starts here:
 /usr/local/include
 /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Framewo

其中 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include即为路径。

实践:

 /Library/Developer/CommandLineTools/usr/include

2.

打开finder使用shift + command + G或者直接用聚焦进行搜索进入该路径。首先修改include文件夹的访问权限为读写。首先要关闭系统的sip保护(存疑),然后可以直接在terminal输入

sudo chmod 777 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include

实践:不需要这步

3.

进入include文件夹新建一个bits文件夹,内部新建一个stdc++.txt的文本文件,内容为:

实践:进入include文件夹新建一个stdc++.txt的文本文

// 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

然后把.txt后缀改成.h即可,打开sublime 写一个helloworld会发现可以用了QWQ。

标签:std,macOS,头文件,usr,c++,Library,include,CommandLineTools,Developer
From: https://www.cnblogs.com/caterpillor/p/18226076

相关文章

  • 库函数和头文件
    库函数C/C++标准中规定的,编译器自带的函数,不用自己再去单独写实现这一功能的函数。如下面的头文件中,cmath就是数学库函数,可以实现求平方根,绝对值等等功能。#include<cmath>头文件C++编译器提供许多头文件,头文件内部包含了对于库函数的声明以及其他信息,如cin,cout的定义:#i......
  • VMware ESXi 7.0U3q macOS Unlocker & OEM BIOS 集成网卡驱动和 NVMe 驱动 (集成驱动
    VMwareESXi7.0U3qmacOSUnlocker&OEMBIOS集成网卡驱动和NVMe驱动(集成驱动版)ESXi7U3标准版集成Intel网卡、RealtekUSB网卡和NVMe驱动请访问原文链接:https://sysin.org/blog/vmware-esxi-7-u3-sysin/,查看最新版。原创作品,转载请保留出处。作者主页:sy......
  • VMware ESXi 7.0U3q macOS Unlocker & OEM BIOS 标准版和厂商定制版
    VMwareESXi7.0U3qmacOSUnlocker&OEMBIOS标准版和厂商定制版ESXi7.0U3标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)OEM定制版请访问原文链接:https://sysin.org/blog/vmware-esx......
  • C++ std::function和std::bind的六种用法总结
    一,使用funciton和bind的六种方法1,使用function接收普通函数2,使用function接收lambda函数3,使用function函数来接收函数对象4,使用bind函数绑定类中的一般函数5,使用bind函数绑定类中的多态函数6,使用function来实现回调。二,代码实现直接看代码和注释:#include<iostream>#......
  • macos php 如何链接神通数据库aci
    环境:macosphp版本:7.4利用:docker我得先喷一下刚开始装的x86官网上下载的居然没有pdo扩展最后在网上找到了arm64的扩展简直了...1。编写dockerfileFROMbai615/arm64-php:7.4.33-fpmRUNsed-i's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g'/etc/apt/sources.lis......
  • 在 macOS 上,使用 Homebrew 来安装 OpenJDK 8
    在macOS上,你可以使用Homebrew来安装OpenJDK8。以下是安装和验证的步骤:1.使用Homebrew安装OpenJDK8:brewinstallopenjdk@8安装完成: 2.设置环境变量(可选):按照前面的安装提示设置环境变量:test@MacBook-Pro~%sudoln-sfn/usr/local/opt/openjdk@8/libex......
  • std-软件过程与管理期末复习
    软件过程与管理一、概论1.软件工程的三要素。过程、方法、工具  软件过程的定义。软件过程是用于软件开发及维护的一系列活动、方法及实践3.常见的软件过程分类。常见的软件过程。  二、软件质量管理1.软件质量的定义。  2.ISO/IEC9126的结构、ISO/......
  • 在macos系统上使用vba把excel的每个工作表另存为csv文件
    SubExportWorksheetsAsCSVOnMac()DimwsAsWorksheetDimnewWbAsWorkbookDimnewWsAsWorksheetDimsavePathAsStringDimfileNameAsStringDimfilePermissionCandidates'导出所有工作表到单独的csv文件,并以工作表命名,保存路径......
  • Homebrew Tap:酿造你的个性化 macOS 软件库
    对于macOS用户来说,Homebrew无疑是一个强大的软件包管理工具,它极大简化了软件的安装、更新和卸载。然而,有时候我们仍然会发现一些特定的、小众的或者专业的软件并不在其中。这时,HomebrewTap就成了救星,它允许我们添加和管理第三方仓库,也可以扩展和定制自己的软件库,从而......
  • C++容器之无序集(std::unordered_set)
    目录1概述2使用实例3接口使用3.1construct3.2assigns3.3iterators3.4capacity3.5find3.6count3.7equal_range3.8emplace3.9emplace_hint3.10insert3.11erase3.12clear3.13swap3.14bucket_count3.15max_bucket_count3.16bucket_s......