zenn.skin 무료버전 배포중!
자세히보기

Legacy

[C++] xcode에서 bits/stdc++.h

koosco! 2022. 10. 31. 12:51

stdc++.h는 자주 사용되는 라이브러리리들을 컴파일하도록 도와주어 하나씩 추가해야 하는 번거로움을 줄여줍니다.

stdc++.h 안에 있는 라이브러리들을 단순히 모두 컴파일해주는 작업이므로, 불필요한 라이브러리들까지 추가된다는 단점이 있습니다.

stdc++.h는 표준 라이브러리가 아니기 때문에 파일을 직접 추가해주어야 합니다.

 

 

Linux GCC 4.8.0 /bits/stdc++.h header definition with <cstdalign> error fixed.

Linux GCC 4.8.0 /bits/stdc++.h header definition with <cstdalign> error fixed. - stdc++.h

gist.github.com

 

위 링크에서 stdc++.h에 대해 확인할 수 있습니다.

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
$ sudo mkdir bits
$ cd bits
$ sudo vi stdc++.h

위 경로로 들어가 파일을 생성하고 라이브러리를 만들어 직접 추가해줄 수 있습니다.

아래는 stc++.h에 포함되는 라이브러리들입니다.

// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 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 <cstdalign>
#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

'Legacy'의 다른글

  • 현재글 [C++] xcode에서 bits/stdc++.h