프로그램 사용/gcc2015. 7. 29. 13:47

한번 시도는 해봐야겠다.


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).

[링크 : http://softwareji.tistory.com/65]

Posted by 구차니