한번 시도는 해봐야겠다.
g++ -Wall -fexceptions -H -g -c main.cpp -o obj/Debug/main.o
! /usr/local/include/boost/xpressive/xpressive.hpp.gch
main.cpp
. /usr/include/c++/4.4/iostream
.. /usr/include/c++/4.4/x86_64-linux-gnu/bits/c++config.h
.. /usr/include/c++/4.4/ostream
.. /usr/include/c++/4.4/istream
main.cpp
The ! means that the compiler was able to use the precompiled header. An x means it was not able to use it. Using the appropriate compiler flags is crucial. I took off the -H and ran some speed tests. The precompiled header had an improvement from 14 seconds to 11 seconds. Not bad but not great.
Note: Here's the link to the example: http://www.boost.org/doc/libs/1_43_0/doc/html/xpressive/user_s_guide.html#boost_xpressive.user_s_guide.examples I couldn't get it to work in the post.
[링크 : http://stackoverflow.com/questions/58841/precompiled-headers-with-gcc]
Caution: There are a few known situations where GCC will crash when trying to use a precompiled header. If you have trouble with a precompiled header, you should remove the precompiled header and compile without it.
To create a precompiled header file, simply compile it as you would any other file, if necessary using the -x option to make the driver treat it as a C or C++ header file.
Each of the following options must be the same when building and using the precompiled header:
-fexceptions -funit-at-a-time
[링크 : https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Precompiled-Headers.html]
아래는 cpp 의 경우,
g++ -x c++-header stdafx.h -o stdafx.h.gch
아래는 c 의 경우,
gcc -x c-header stdafx.h -o stdafx.h.gch
[링크 : https://kldp.org/node/22714]
Precompiled headers are supported in GCC (3.4 and newer).
'프로그램 사용 > gcc' 카테고리의 다른 글
gcc 초기화 관련 (0) | 2015.10.21 |
---|---|
precompiled header on GCC (라즈베리로 테스트) (2) | 2015.07.30 |
gcc 64bit 변수 선언하기 (0) | 2015.07.14 |
gcc 32bit/ 64bit 컴파일하기 (0) | 2015.07.14 |
gcc 특정 표준 따르도록 강제하기 (0) | 2015.07.14 |