C++ Tools Ecosystem C++ Tools Ecosystem C++ Tools
Compile
Offline
The de-facto standard in the Linux world.
Only newer versions are largely conforming to the modern ISO C++ standard(s).
Online
Compiler Explorer
- lets you run code through many different compilers
- shows nicely annotated assembly output
- lots of compilers with lots of different versions, also with experimental features
- supports several popular libraries (ranges, {fmt}, …)
- great text editor with multiple cursors, VIM mode, dark mode, …
- code round-trip between Compiler Explorer, C++ Insights and Quick Bench possible
- gcc
- clang
- C++03 - C++2a
- Boost
- gcc
- gcc 4.9
- Boost 1.55
- C++03 - 14
- C++14
Debug
the GNU debugger
the LLVM project's debugger
- records program state over time
- replay & debug same recording many times
- reverse execution
- chaos mode for catching intermittent bugs
- claims to be faster and more memory efficient than GDB
does also provide record & replay debugging like rr
(here called time travel debugging
)
- debugging of DLL and EXE files
- UI with symbol view, thread view, source code view, dynamic stack view, memory map
- built-in assembler, decompiler
- supports executable patching
template metaprogramming debugger
part of Metashell, an iteractive template metaprogramming shell
- runs in the command line
- split screen with source code window
- shows break points and current instruction
- install on Ubuntu/Debian/WSL: sudo apt install -y cgdb
- browser-based frontend for GDB
- install via pip: sudo pip install gdbgui
- official GNU debugger frontend
- The UI is a bit old-fashioned, but it is actually quite usable if you spend some time with it.
- install on Ubuntu/Debian/WSL: sudo apt install -y ddd
debugging with GDB in Microsoft Visual Studio
relatively new Qt-based GUI frontent for GDB
Online GDB
Online compiler and debugger tool for C, C++, Python and many other languages.
Sanitizers
- g++ -fsanitize=address
- clang++ -fsanitize=address
- cl.exe /fsanitize=address MSVC (as of 10/2019)
- g++ -fsanitize=undefined
- clang++ -fsanitize=undefined
- g++ -fsanitize=leak
- clang++ -fsanitize=leak
- g++ -fsanitize=thread
- clang++ -fsanitize=thread
Stand-Alone
clang-based linter tool, part of the extra clang tools
diagnoses programming errors, style violations, interface misuse
- code instrumentation framework
- runs program on a VM
- --tool=memcheck leak, invalid read/write detection
- --tool=callgrind runtime profiling
- --tool=cachegrind cache profiling
- --tool=massif heap memory profiling
- integration into various IDEs
- dynamic instrumentation (runs on unmodified binaries)
- leak detection
- invalid memory read/write detection
- heap memory profiler
- annotation of memory allocations
- memory leak detection
- integration into various IDEs
- source code analysis tool
- code quality metrics
- coding standard compliance analysis
- dependency visualization
- Visual Studio add-in
- commercial static code analysis tool
- IDE itegration (Visual Studio, VS Code, CLion, QtCreator, Eclipse)
clang-based #include
analyzer
analyzes C++ #include
dependencies
Applications
Intel VTune Profiler
- free of charge
- GUI & command line interface
- sampling-based profiling
- hardware event sampling for Intel chips
- locks & waits analysis
- memory access analysis
- storage analysis
- integrates with MS Visual Studio
Coz – Causal Profiler
- unique approach to profiling
- creates causal profile: "optimizing function X will have effect Y"
- profile is based on performance experiments
- program is partitioned into parts based on progress points (that are set in source code)
- no additional instrumentation of source code required
NVIDIA Nsight Compute
- profiling for NVIDIA GPUs (architectures: Pascal, Volta, Turing)
- supplants NVIDIA Visual Profiler
AMD uProf
- sampling profiler for AMD CPUs and some AMD GPUs
- instruction based sampling, micro-architecture analysis,
- call stack sampling, timer-based profiling
- cache analysis, power profiling
Benchmarking Libraries
- Apache-2.0
Google Benchmark
- BSD-3-Clause
gperftools
(originally Google Performance Tools)
- high-performance multithreaded
malloc()
- heap checker
- heap profiler
- cpu profiler
- Apache-2.0
Celero
Build
Quite OK for small projects. Every C++ programmer should know how to use Make.
- ubiquitous, portable
- a lot of limitations
- not very expressive syntax
Seems to be(come) the de-facto standard in the C++ world.
- available on a lot of platforms
- lot of tutorials, resources, etc.
- used as project model by some IDEs
- can be slow at times
- carries a lot of technical debt
- clumsy syntax
- Command-line based build system from Microsoft packaged with Microsoft Visual Studio , but also available as stand-alone application.
- XML-based build files
- supported by , Embarcadero C++Builder
- uniform across platforms, no project generation step
- supports wildcard patterns
- support for C++ Modules
- support for cross-compilation
- skips recompilation of ignorable changes (comments, whitespaces, etc).
- dependency management
- no dependencies, only C++ compiler required
- automatic dependency analysis
- uses a real programming language (Python) for config files
- pretty verbose; even common tasks require a lot of code
- can be slow for big projects
tool for generating compilation databases (compile_commands.json) for clang tooling and/or LSP language servers
Test
- probably the best choice for small/quick projects
- approach allows for well-structured, self-documenting tests
- modeled after Catch2 (shares some code with it)
- easy to set up, one header only
- very fast compilation & execution
- very good and concise documentation
- approach allows for well-structured, self-documenting tests
- relatively easy to set up
- very good and concise documentation
- data generation helpers
- set of predefined
matchers
for comparing values - microbenchmarking tools
- logging
- BSD 3-Clause "New" or "Revised"
Google Test
- BSL-1.0
Boost Test
QtTest
Part of the Qt Project .
- MIT
Bandit
- BSD-3-Clause
CppUTest
Package
- decentralized
- build systems: CMake, MSBuild, …
- binary packages
- Visual Studio integration
- CMake support
- only builds from source
- programming-language agnostic (C, C++, Python, R, …)
- originated in HPC / scientific computing community
- can install many coexisting variants of library package versions and build configurations
- CMake only
- GitHub, BitBucket, GitLab, …
- integrates into various IDEs
Code
IDEs
Qt Creator
- quite beginner-friendly
- very responsive UI
- has a VIM emulation mode (could be better, but it works)
JetBrains CLion
- lots of features
- highly customizable, modern UI
- uses CMake as project model, however recent versions can also use traditional Makefiles
- has a VIM emulation mode (could be better, but it works)
- can be a bit slow for very large projects
- can be quite overwhelming for beginners
- free for students
Microsoft Visual Studio
- packed with features; very good autocompletion and code analysis
- large ecosystem of third-party plugins
- project setup and compiler configuration can be a bit overwhelming for beginners
- Make sure to use the latest version, as only newer versions of the compiler are largely conforming to the modern ISO C++ standard(s).
Embarcadero C++Builder
- can be used to create apps for Windows and iOS
- great UI builder
- ships with a clang-based compiler
- ships with Boost and a few other C++ libraries
- mostly complete support for C++17 (no parallel algorithms)
- no C++20 support yet
- uses MSBuild by default, but has command-line supprt for CMake
- free community edition for students/hobbyists that also includes a (very) small business commercial license
- academic license available
Eclipse CDT
- good static analysis & linting
- supports several project build models: fully managed, Makefile-based, …
- setup of compilers can be a bit confusing to beginners
- great VIM emulation with
Vrapper
plugin - can be a bit slow for very large
- UI feels a bit dated
Embarcadero Dev-C++
- quite beginner-friendly, very easy to set up
gcc
integration, comes with bundled TDM-gccgprof
integration- low memory consumption
- UI feels a bit dated
Cevelop
- Eclipse-based IDE
- some unique features regarding static analysis and refactoring, like e.g., visualizing template instantiations
- can be a bit slow for very large projects
Text
- nice modern UI
- thriving extension ecosystem
- origin of the Language Server Protocol
- highly configurable VIM plugin with surround, easymotion, highlightedyank, …
A classic and insanely powerful.
Has quite a steep learning curve, but the modal editing paradigm is really worth learning. Only real drawback: once you grok it, you want VIM-style editing everywhere.
highly customizable, large plugin ecosystem
- a refactor of VIM and mostly compatible with it
- integrated LSP support planned for the next major release
Also a classic; also super powerful.
- sleek UI
- very fast interaction & file I/O
- highly customizable, large plugin ecosystem
- LSP client plugin available
The default editor for the KDE desktop environment.
- built-in LSP client
- very fast interaction & file I/O
- nice UI
- customizable, large plugin ecosystem
- sometimes a bit sluggish
- LSP plugin available, still lacks some features
The default editor for the Gnome desktop environment.
- quite fast
- no LSP client / plugin
A classic in the Windows world. Quite OK, but not as powerful as the other editors in this list.
A terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals. It comes as a single, batteries-included, static binary with no dependencies.
Formatters
The de-facto industry standard for version control.
- very fast
- possible to set up elaborate workflows
- complex command line interface
Python-based source control management system.
- easier to learn than git
- beginner-friendly documentation
- a bit slower than git
- some, more involved workflows not possible out-of-the box
Tools
Command Line Git Frontend
- VIM-style key mapping
- commit view with branch graph
- (un-)staging, diff, stash, log, grep
- configurable UI
Git Merging / Commit Crafting Tool
- very fast UI
- line-by-line staging
- commit editing
- diff view, same syntax highlighting as Sublime Text
- multiple repositories (in tabs)
- can use external or bundled git client
Web
Compiler Explorer
- lets you run code through many different compilers
- shows nicely annotated assembly output
- lots of compilers with lots of different versions, also with experimental features
- supports several popular libraries (ranges, {fmt}, …)
- great text editor with multiple cursors, VIM mode, dark mode, …
- code round-trip between Compiler Explorer, C++ Insights and Quick Bench possible
C++ Insights
Source-to-source transformation tool that makes
behind-the-scenes compiler magic
visible and understandable.
Shows the code that clang
generates for
lambdas, range-based for
loops, structured bindings, etc.
Quick Bench
Benchmark code (using Google Benchmark) and get a nice visual runtime breakdown.
You can choose from various versions of gcc
or clang
.
Online GDB
Online compiler and debugger tool for C, C++, Python and many other languages.
Comments…