gpt4 book ai didi

c++ - 编译时实际包含哪些文件

转载 作者:可可西里 更新时间:2023-11-01 18:22:02 27 4
gpt4 key购买 nike

我有一个非常大的代码,其中很多是遗留代码。我想知道所有这些文件中有哪些参与了编译。代码是用 GNU 编译器编写的,大部分是用 C/C++ 编写的,但也有一些是用其他程序编写的。任何建议将不胜感激。

谢谢,

摩西。

我在 linux 下使用脚本/makefile 进行编译。我想用一种工具以某种方式“包装”这个构建,该工具将提供构建中使用的所有源文件的输出,最好是绝对路径名。

你说呢?

最佳答案

如果您想显示包含的 header ,那么是否支持以及如何实现取决于编译器。

例如,

C:\test> (g++ --help --verbose 2>&1) | find "header"
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers
--sysroot=<directory> Use <directory> as the root directory for headers
-H Print the name of header files as they are used
-MG Treat missing header files as generated files
-MM Like -M but ignore system header files
-MMD Like -MD but ignore system header files
-MP Generate phony targets for all headers
-Wsystem-headers Do not suppress warnings from system headers
-print-objc-runtime-info Generate C header of platform-specific features
-ftree-ch Enable loop header copying on trees

C:\test> (cl /? 2>&1) | find "include"
/FI<file> name forced include file /U<name> remove predefined macro
/u remove all predefined macros /I<dir> add to include search path
/nologo suppress copyright message /showIncludes show include file names

C:\test> _

在上面你可以分别看到g++和Visual C++的相关选项。

干杯,

– 阿尔夫

关于c++ - 编译时实际包含哪些文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3900874/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com