我使用Ubuntu 20.04
。当我cpp -v
在终端中运行时,输出如下:
...
...
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/9/cc1 -E -quiet -v -imultiarch x86_64-linux-gnu - -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
问题是搜索列表结束,直到我按下 ,命令才会结束CTRL + C。
我想知道是什么原因导致了这个问题以及如何解决它?
答案1
从man cpp
:
The cpp command expects two file names as arguments, infile and
outfile. The preprocessor reads infile together with any other files
it specifies with #include. All the output generated by the combined
input files is written in outfile.
Either infile or outfile may be -, which as infile means to read from
standard input and as outfile means to write to standard output. If
either file is omitted, it means the same as if - had been specified
for that file. You can also use the -o outfile option to specify the
output file.
因此,由于您没有提供infile
,cpp -v
正在等待您通过终端提供标准输入;如果您希望提供空的输入你可以使用类似
cpp -v /dev/null
或者
: | cpp -v