gcc 3.3.3支持预编译头文件?

时间:2023-01-31 16:57:38

Are precompiled headers supported on gcc 3.3.3 ?

gcc 3.3.3是否支持预编译头文件?

If yes what is the syntax to generate and use precompiled headers on Linux with gcc 3.3.3. We crosscompile our projects on Windows and Linux, on Windows we precompile stdafx.h and I'm investigating how to set it up so that it is precompiled on Linux as well.

如果是,使用gcc 3.3.3在Linux上生成和使用预编译头文件的语法是什么。我们在Windows和Linux上交叉编译我们的项目,在Windows上我们预编译stdafx.h并且我正在调查如何设置它以便它也在Linux上预编译。

I'm aware of the gcc doc , I'm searching for the actual solution.

我知道gcc doc,我正在寻找实际的解决方案。

On gcc 3.3.3 I get this:

在gcc 3.3.3上我得到了这个:

> gcc stdafx.h
gcc: compilation of header file requested

And last, if it worked what would be the name of generated file?

最后,如果它起作用生成文件的名称是什么?

EDIT: Precompiled headers do not seem to be supported on gcc 3.3.3 and on newer gcc the generated file is named with .gch extension.

编辑:gcc 3.3.3似乎不支持预编译头文件,而在较新的gcc上,生成的文件以.gch扩展名命名。

3 个解决方案

#1


I don't know from what version gcc supports it, but for how to use them just read the gcc documentation.

我不知道gcc支持它的版本,但是如何使用它们只需阅读gcc文档。

Anyway, gcc 3.3.3 is pretty old, too. Maybe there's a chance that you can upgrade to a more recent 4.X version? That should support recompiled headers.

无论如何,gcc 3.3.3也很老了。也许你有可能升级到更新的4.X版本?这应该支持重新编译的标头。

Maybe you could try the latest 3.X GCC (GCC 3.4.6). I assume the ABI break is from 3.X to 4.X, so 3.4 may be compatible. I think it may be worth checking.

也许你可以尝试最新的3.X GCC(GCC 3.4.6)。我假设ABI中断是从3.X到4.X,所以3.4可能是兼容的。我认为这可能值得一试。

from http://gcc.gnu.org/gcc-3.4/changes.html

C/Objective-C/C++
Precompiled headers are now supported.

C / Objective-C / C ++现在支持预编译头文件。

#2


I'm not entirely sure if GCC 3.3 supports it, but precompiling headers is actually no different from producing objects, at least with GCC 4.x:

我不完全确定GCC 3.3是否支持它,但预编译头实际上与生成对象没有区别,至少对于GCC 4.x:

gcc $CFLAGS header.h

It'll produce a new precompiled header next to the .h file and automatically use it when it's #included.

它会在.h文件旁边生成一个新的预编译头文件,并在#included时自动使用它。

#3


I don't remember about if it is supported in gcc 3.3.3. The output file be {filename.ext}.gch

我不记得gcc 3.3.3是否支持它。输出文件为{filename.ext} .gch

#1


I don't know from what version gcc supports it, but for how to use them just read the gcc documentation.

我不知道gcc支持它的版本,但是如何使用它们只需阅读gcc文档。

Anyway, gcc 3.3.3 is pretty old, too. Maybe there's a chance that you can upgrade to a more recent 4.X version? That should support recompiled headers.

无论如何,gcc 3.3.3也很老了。也许你有可能升级到更新的4.X版本?这应该支持重新编译的标头。

Maybe you could try the latest 3.X GCC (GCC 3.4.6). I assume the ABI break is from 3.X to 4.X, so 3.4 may be compatible. I think it may be worth checking.

也许你可以尝试最新的3.X GCC(GCC 3.4.6)。我假设ABI中断是从3.X到4.X,所以3.4可能是兼容的。我认为这可能值得一试。

from http://gcc.gnu.org/gcc-3.4/changes.html

C/Objective-C/C++
Precompiled headers are now supported.

C / Objective-C / C ++现在支持预编译头文件。

#2


I'm not entirely sure if GCC 3.3 supports it, but precompiling headers is actually no different from producing objects, at least with GCC 4.x:

我不完全确定GCC 3.3是否支持它,但预编译头实际上与生成对象没有区别,至少对于GCC 4.x:

gcc $CFLAGS header.h

It'll produce a new precompiled header next to the .h file and automatically use it when it's #included.

它会在.h文件旁边生成一个新的预编译头文件,并在#included时自动使用它。

#3


I don't remember about if it is supported in gcc 3.3.3. The output file be {filename.ext}.gch

我不记得gcc 3.3.3是否支持它。输出文件为{filename.ext} .gch