clang++

Compiles C++ source files. Part of LLVM. More information: <https://clang.llvm.org>.

Install

All systems
curl cmd.cat/clang++.sh
Debian Debian
apt-get install clang-3.4
Ubuntu
apt-get install clang-8
Alpine
apk add ccache
Arch Arch Linux
pacman -S ccache
image/svg+xml Kali Linux
apt-get install icecc
CentOS
yum install clang
Fedora
dnf install chromium-native_client-1
Windows (WSL2)
sudo apt-get update sudo apt-get install clang-8
OS X
brew install ccache
Raspbian
apt-get install clang-3.2
Docker
docker run cmd.cat/clang++ clang++ powered by Commando

Compiles C++ source files. Part of LLVM. More information: <https://clang.llvm.org>.

  • Compile a source code file into an executable binary:
    clang++ path/to/source.cpp -o path/to/output_executable
  • Display (almost) all errors and warnings:
    clang++ path/to/source.cpp -Wall -o path/to/output_executable
  • Choose a language standard to compile with:
    clang++ path/to/source.cpp -std=c++20 -o path/to/output_executable
  • Include libraries located at a different path than the source file:
    clang++ path/to/source.cpp -o path/to/output_executable -Ipath/to/header_path -Lpath/to/library_path -lpath/to/library_name
  • Compile source code into LLVM Intermediate Representation (IR):
    clang++ -S -emit-llvm path/to/source.cpp -o path/to/output.ll
  • Optimize the compiled program for performance:
    clang++ path/to/source.cpp -O1|2|3|fast -o path/to/output_executable

© tl;dr; authors and contributors