我如何包括<;bits/stdc++&燃气轮机;在Xcode中 我尝试在我的C++代码中包含头文件位/STDC++ +,但是编译器似乎不支持它。有什么办法使它起作用吗
我使用OS X Yosemite 10.10.2和Xcode 6.1.1。你不能。X-Code使用LLVM工具链和Clang作为编译器,而我如何包括<;bits/stdc++&燃气轮机;在Xcode中 我尝试在我的C++代码中包含头文件位/STDC++ +,但是编译器似乎不支持它。有什么办法使它起作用吗,c++,xcode,macos,C++,Xcode,Macos,我使用OS X Yosemite 10.10.2和Xcode 6.1.1。你不能。X-Code使用LLVM工具链和Clang作为编译器,而特定于GNU编译器工具链 其次,正如其他人所说,您不应该首先使用该标题。您可以从这里复制stdc++.h文件: 你可以把文件包含在C++文件中: //suppose the file is in your home folder, here my username is reza #include "/Users/reza/stdc++.h" 因为,b
特定于GNU编译器工具链
其次,正如其他人所说,您不应该首先使用该标题。您可以从这里复制stdc++.h文件: <>你可以把文件包含在C++文件中:
//suppose the file is in your home folder, here my username is reza
#include "/Users/reza/stdc++.h"
因为,bits/stdc++是GNU GCC扩展,而OSX使用clang编译器 您必须在/usr/local/include内创建bits目录,然后在bits内创建一个头文件stdc++.h,并粘贴其中的内容。 然后,它应该按照预期编译
因为,/usr目录在Mac OSX上默认是隐藏的
(更新:对于最新的OS X,您需要将文件夹include放入本地,并将bits文件夹放入include文件夹,然后复制粘贴bits文件夹中的代码。)Mac OS X 10.9+不再使用GCC/libstdc++而是使用libc++和Clang XCode 6.0.1更新后,标题现在位于此处:
/Applications/Xcode.app/Contents/Developer/Toolchains/xcodefault.xctoolchain/usr/include/c++/v1
因此,从中获取stdc++.h文件,然后在上面的长地址中创建bits目录,并将文件stdc++.h复制到bits目录
现在,从中获取stdc++.h文件,然后在上面的长地址中创建bits目录,并将文件stdc++.h复制到bits目录。1.从…下载stdc++.h文件 2.在Finder中按CTRL+SHIFT+G并打开/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/ 3.创建文件夹位并将下载的文件复制到此处
在将bits/stdc++.h添加到mac os平台之前,首先要弄清楚包含文件的位置。找出mac环境中正在使用的包含文件
- 在终端中运行此命令: 回声“| gcc-xc--v-E
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/......."
ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/local/include"
ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 361 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2
Apple LLVM版本10.0.1(clang-1001.0.46.4)
目标:x86_64-apple-darwin18.7.0
线程模型:posix
InstalledDir:/Library/Developer/CommandLineTools/usr/bin
“/Library/Developer/…”
忽略不存在的目录
“/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/local/include”
忽略不存在的目录
“/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/Library/Frameworks”
#包括“…”搜索从这里开始:
#包括搜索从这里开始:
/usr/本地/包括
/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/include
/库/Developer/CommandLineTools/usr/include
/库/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks(框架目录)
搜索列表结束。
# 1 ""
# 1 "" 1
# 1 "" 3
# 361 "" 3
# 1 "" 1
# 1 "" 2
# 1 "" 2
- 转到包含路径。ex:/usr/local/include 创建bits文件夹并添加文件
- mkdir/usr/local/include/bits
- vim/usr/local/include/bits/stdc++.h
- 切换到插入模式(按i键)并粘贴剪贴板内容
- 保存/退出(Esc+:+w+q+Enter)
标准GNU编译器G++不直接支持此标头,因此我们使用以下步骤将其包含在所需位置:
希望有帮助!:D只需在文件目录中创建一个头文件,如bitsStdcpp.hpp文件, 在该文件中添加以下代码 并使用#include“bitsStdcpp.hpp”代替#include
#包括
使用名称空间std;
#如果没有断言
#包括
#恩迪夫
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#如果uu cplusplus>=201103L
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#恩迪夫
//C++
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#
#include <stdio.h>
using namespace std;
#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 /* bitsStdcpp_hpp */