mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-04 04:43:49 +00:00
38 lines
870 B
Plaintext
38 lines
870 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, windows]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# cl
|
|
|
|
> The Microsoft C/C++ compiler for compiling and linking source code files.
|
|
> More information: <https://learn.microsoft.com/cpp/build/reference/compiler-command-line-syntax>.
|
|
|
|
- Compile a source file:
|
|
|
|
`cl {{path o\source.c}}`
|
|
|
|
- Compile and create an executable with a custom name:
|
|
|
|
`cl /Fe {{path o\output_executable}} {{path o\source.c}}`
|
|
|
|
- Compile a source file with optimization enabled:
|
|
|
|
`cl /O2 {{path o\source.c}}`
|
|
|
|
- Compile a source file and create a debug executable:
|
|
|
|
`cl /Zi {{path o\source.c}}`
|
|
|
|
- Compile multiple source files:
|
|
|
|
`cl {{path o\source1.c path o\source2.c ...}}`
|
|
|
|
- Specify the output directory for compiled files:
|
|
|
|
`cl /Fo {{path o\output_directory}}/ {{path o\source.c}}`
|
|
|
|
- Compile with warnings as errors:
|
|
|
|
`cl /WX {{path o\source.c}}`
|