Sun Studio 12:C 用户指南

B.2.125 -xpchstop=[file|<include>]

使用 -xpchstop=file 选项可为预编译头文件指定活前缀的最后一个 include 文件。在命令行使用 -xpchstop 与将 hdrstop pragma 置于第一个包含指令之后等效,此包含指令在您使用 cc 命令指定的每个源文件中引用 file

结合使用 -xpchstop=<include>-xpch-auto 可以创建基于从其往上并包括 <include> 的头文件的预编译头文件。此标志覆盖缺省的 -xpch=auto 行为(使用整个活前缀中包含的所有头文件的行为)。

在以下示例中,-xpchstop 选项指定了预编译头文件的活前缀以 projectheader.h 的包含结束。因此,privateheader.h 不是活前缀的一部分。


example% cat a.c
     #include <stdio.h>
     #include <strings.h>
     #include "projectheader.h"
     #include "privateheader.h"
     .
     .
     .
example% cc -xpch=collect:foo.cpch a.c -xpchstop=projectheader.h -c

另请参见 -xpch