← 返回命令列表

Linux command

clang-cpp 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run the C preprocessor

clang-cpp [source.c]

Preprocess with defines

clang-cpp -D[MACRO]=[value] [source.c]

Preprocess with include path

clang-cpp -I[/path/to/includes] [source.c]

Output to file

clang-cpp [source.c] -o [output.i]

说明

clang-cpp is the Clang C preprocessor. It handles #include directives, macro expansion, and conditional compilation, outputting the preprocessed source. This is the LLVM/Clang equivalent of cpp from GCC.

参数

-D _macro=value_
Define a preprocessor macro.
-U _macro_
Undefine a preprocessor macro.
-I _path_
Add include search path.
-o _file_
Write output to file.
-E
Preprocess only (implied).

FAQ

What is the clang-cpp command used for?

clang-cpp is the Clang C preprocessor. It handles #include directives, macro expansion, and conditional compilation, outputting the preprocessed source. This is the LLVM/Clang equivalent of cpp from GCC.

How do I run a basic clang-cpp example?

Run `clang-cpp [source.c]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -D _macro=value_ do in clang-cpp?

Define a preprocessor macro.