Skip to content

Setup C/C++ Compiler

Actions
Install selected C/C++ compiler
v1.2
Latest
Star (9)

Test

This GitHub action sets up selected C/C++ compiler in your workflow run.

The action requires specyfing compiler version using compiler input.

Use it in your workflow like this:

    - name: Install compiler
      id: install_cc
      uses: rlalik/setup-cpp-compiler@master
      with:
        compiler: latest

Output variables:

  • cc - holds C compiler
  • cxx - holds C++ compiler

Example usage:

    - name: Use compiler
        shell: bash
        env:
            CC: ${{ steps.install_cc.outputs.cc }}
            CXX: ${{ steps.install_cc.outputs.cxx }}

OS selection

Currently only Ubuntu and Windows are fully supported. For MacOS it is possible to install selected gcc however clang will always fallback to system default.

Compiler selection

The input compiler can take following names:

  • latest - resolves to the default gcc on a given system
  • gcc or gcc-latest - resolves to the default gcc on a given system
  • clang or clang-latest - resolves to the default clang on a given system
  • other values - depending on selected OS, see sections below.

Exceptions:

  • on MacOS, each gcc must have specified version, thus latest, gcc, gcc-latest are not allowed
  • on MacOS, clang versions are not supported

Available compilers

The available compilers are specific to the selected operating system.

You can check available versions here:

Example values of complilers

      matrix:
        os-version: [ ubuntu-latest ]
        compiler: [ latest, gcc-latest, gcc-9, gcc-10, g++-11, clang, clang-10, clang-11, clang++-12 ]
      matrix:
        os-version: [ windows-latest ]
        compiler: [ latest, gcc-latest, gcc-6.4.0, gcc-10.2.0, g++-11.2.0, clang, clang-8.0.0, clang-11.1.0, clang++-12.0.1 ]

Setup C/C++ Compiler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Install selected C/C++ compiler
v1.2
Latest

Setup C/C++ Compiler is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.