[英]Display currently compiling filename in gcc under linux
When compiling multiple files with gcc (ie: gcc *.c), a large project may take some time to compile and, if no errors are found, the screen remains static for some time. 使用gcc编译多个文件(即gcc * .c)时,大型项目可能需要花费一些时间进行编译,如果未发现错误,则屏幕将保持静态一段时间。 Does gcc have a command line option to display the filename of the c file its currently compiling? gcc是否具有命令行选项来显示其当前正在编译的c文件的文件名?
gcc
is just a driver program which uses cc1
to actually compile input C files. gcc
只是一个驱动程序, 使用cc1
实际编译输入的C文件。
That said, you can simply check arguments of gcc
child processes to get what gcc
is up to. 也就是说,您可以简单地检查gcc
子进程的参数来获取gcc
的最新信息。 Ie: 即:
> gcc 1.c 2.c & ps -f --forest
[1] 22907
UID PID PPID C STIME TTY TIME CMD
myaut 21963 18153 0 20:21 pts/1 00:00:00 /bin/bash
myaut 22907 21963 0 20:41 pts/1 00:00:00 \_ gcc 1.c 2.c
myaut 22909 22907 0 20:41 pts/1 00:00:00 | \_
/usr/lib64/gcc/x86_64-suse-linux/4.8/cc1 -quiet 1.c -quiet -dumpbase
1.c -mtune=generic -march=x86-64 -auxbase 1 -o
myaut 22908 21963 0 20:41 pts/1 00:00:00 \_ ps -f --forest
In this example I was lucky enough to capture child process which actually compiles 1.c with ps
which has started almost simultaneously with gcc
在此示例中,我很幸运地捕获了实际上使用ps
编译1.c的子进程,该进程几乎与gcc
同时启动
Anyway, using a full fledged building system on top of GCC (make, CMake or SCons) is a much better for compiling project consisting of multiple files. 无论如何,在GCC(make,CMake或SCons)之上使用完整的构建系统对编译包含多个文件的项目要好得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.