Linux command
c99 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Compile a C source file to an executable
c99 [file.c] -o [output]
Compile without linking (produce object file)
c99 -c [file.c]
Compile with a library
c99 [file.c] -l[library] -o [output]
Define a preprocessor macro
c99 -D [NAME=value] [file.c] -o [output]
Add include directory for headers
c99 -I [path/to/includes] [file.c] -o [output]
Compile with optimization
c99 -O [file.c] -o [output]
说明
c99 is the POSIX-standard interface to the C compilation system for compiling C99-conformant source code. It compiles C source files and links them to produce an executable file, or can produce object files for later linking. The command accepts source files (.c), object files (.o), and library archives (.a) as operands. Without the -o option, the executable is written to a.out.
参数
- -c
- Compile only; do not link. Produces object files (.o)
- -D _name_=_value_
- Define preprocessor macro
- -E
- Preprocess only; do not compile
- -g
- Include debugging information
- -I _directory_
- Add directory to header search path
- -L _directory_
- Add directory to library search path
- -l _library_
- Link with specified library
- -o _outfile_
- Write output to specified file
- -O _optlevel_
- Enable optimization (0, 1, 2, 3)
- -s
- Strip symbols from output
- -U _name_
- Undefine preprocessor macro
FAQ
What is the c99 command used for?
c99 is the POSIX-standard interface to the C compilation system for compiling C99-conformant source code. It compiles C source files and links them to produce an executable file, or can produce object files for later linking. The command accepts source files (.c), object files (.o), and library archives (.a) as operands. Without the -o option, the executable is written to a.out.
How do I run a basic c99 example?
Run `c99 [file.c] -o [output]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c do in c99?
Compile only; do not link. Produces object files (.o)