Skip to content

Docker Quick Start

The Docker image provides a ready-to-use C++ development environment with compilers, cmake, the Universal library headers pre-installed, and command-line inspection tools on the PATH.

Terminal window
docker pull stillwater/universal
docker run -it --rm stillwater/universal bash

Write and compile programs using Universal directly inside the container:

hello.cpp
#include <universal/number/posit/posit.hpp>
#include <iostream>
int main() {
sw::universal::posit<16,2> p = 1.5;
std::cout << p << '\n';
}
Terminal window
g++ -std=c++20 -I/usr/local/include/sw -o hello hello.cpp && ./hello
Terminal window
# Inspect IEEE-754 floating-point values
ieee 1.5
# Explore posit representations
posit 1.5
# Compare number systems
propieee 1.5

See Command-Line Tools for a full reference.

For a full development environment with both GCC and Clang pre-installed, use the VS Code Dev Container.

  1. Clone the repository and open it in VS Code.
  2. When prompted, select Reopen in Container (or run the command Dev Containers: Reopen in Container).
  3. Once the container builds, open the CMake Tools preset selector and choose a preset such as gcc-debug or clang-release.
  4. Build and debug as usual with the CMake Tools extension.

CMake presets handle compiler selection automatically. Choose gcc-* presets for GCC or clang-* presets for Clang — no manual toolchain configuration needed.