#pragma hdrstop等语句的意思?

zleia 2003-10-16 10:19:56
在bcb中有许多的预编译指令象:#pragma hdrstop,#pragma package(smart_init)......等的意思.哪位大侠能给我讲一下bcb中的这些指令的具体含义和用法?



...全文
557 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
cupidvenus 2003-10-17
  • 打赏
  • 举报
回复
那么多,还是查帮助吧。
TopCoderONE 2003-10-17
  • 打赏
  • 举报
回复
查帮助,说明很详细的。
我不懂电脑 2003-10-17
  • 打赏
  • 举报
回复
Syntax

#pragma hdrstop

Description

This directive terminates the list of header files eligible for precompilation. You can use it to reduce the amount of disk space used by
precompiled headers.

Precompiled header files can be shared between the source files of your project only if the #include directives before #pragma hdrstop are identical. Therefore, you get the best compiler performance if you include common header files of your project before the
#pragma hdrstop, and specific ones after it. Make sure the #include directives before the #pragma hdrstop are identical in all the source files, or that there are only very few variations.

The integrated development environment generates code to enhance precompiled header performance. For example, after a New Application, source file "Unit1.cpp" will look like this (comments added):

#include <vcl.h> // common header file

#pragma hdrstop // terminate list here

#include "Unit1.h" // specific header file
// ....

Use this pragma directive only in source files. The pragma has no effect when it is used in a header file.
Kabin 2003-10-17
  • 打赏
  • 举报
回复
#pragma hdrstop表示预编译头文件到此为止,后面的头文件不进行预编译。BCB可以预编译头文件以加快链接的速度,但如果所有头文件都进行预编译又可能占太多磁盘空间,所以使用这个选项排除一些头文件。

有时单元之间有依赖关系,比如单元A依赖单元B,所以单元B要先于单元A编译。你可以用#pragma startup指定编译优先级,如果使用了#pragma package(smart_init) ,BCB就会根据优先级的大小先后编译。

#pragma resource "*.dfm"表示把*.dfm文件中的资源加入工程。*.dfm中包括窗体外观的定义。
tigerhohoo 2003-10-17
  • 打赏
  • 举报
回复
Syntax

#pragma hdrstop

Description

This directive terminates the list of header files eligible for precompilation. You can use it to reduce the amount of disk space used by precompiled headers.

Precompiled header files can be shared between the source files of your project only if the #include directives before #pragma hdrstop are identical. Therefore, you get the best compiler performance if you include common header files of your project before the #pragma hdrstop, and specific ones after it. Make sure the #include directives before the #pragma hdrstop are identical in all the source files, or that there are only very few variations.

The integrated development environment generates code to enhance precompiled header performance. For example, after a New Application, source file "Unit1.cpp" will look like this (comments added):
请多参考联机帮助。
#include <vcl.h> // common header file

#pragma hdrstop // terminate list here

#include "Unit1.h" // specific header file
// ....

Use this pragma directive only in source files. The pragma has no effect when it is used in a header file.
ljianq 2003-10-17
  • 打赏
  • 举报
回复
我这有篇关于预编译的文章,是前些天论台上一位网友提供的,地址忘了。

需要的话,可以发给楼主。
ljianq 2003-10-17
  • 打赏
  • 举报
回复
#pragma hdrstop指令告诉编译程序停止产生预先编译的映象。任何在hdrstop指令前
的#include文件都将预编译,而在该指令后的#include文件都将不会预编译。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧