NextDigital Docs
Guides 2 min read

C/C++ IDE Environment

Systems programming with GCC, Clang, GDB, Valgrind, and CMake.

What's Inside

Tool Version Purpose
GCC / G++ Latest GNU C/C++ compiler
Clang Latest LLVM C/C++ compiler
GDB Latest Debugger
Valgrind Latest Memory leak detector
CMake Latest Cross-platform build system
Make / Ninja Latest Build automation
cppcheck Latest Static code analyzer
clang-tidy Latest Linter and code modernizer
clang-format Latest Code formatter

Quick Start

# Compile and run a C file
c-run main.c

# Compile and run a C++ file
c-run main.cpp

# Build a CMake project
c-build

# Check for memory leaks
c-memcheck ./my_program

# Lint your code
c-lint

Helper Commands

Command What it does
c-run <file> Compile + run (auto-detects C or C++)
c-build Build CMake or Make project
c-memcheck <program> Run with Valgrind memory checker
c-lint Run cppcheck + clang-tidy
c-debug <program> Start GDB debugger
c-help Show all available commands

How c-run Works

c-run is smart about what you give it:

# Single C file → compiles with gcc, runs the binary
c-run main.c

# Single C++ file → compiles with g++, runs the binary
c-run main.cpp

# No argument + CMakeLists.txt exists → runs c-build, then executes
c-run

# No argument + Makefile exists → runs make, then executes
c-run

Memory Checking with Valgrind

# Compile with debug symbols
gcc -g -o my_program main.c

# Run Valgrind
c-memcheck ./my_program

Valgrind will report:

  • Memory leaks (definitely lost, possibly lost)
  • Invalid reads/writes (buffer overflows)
  • Use of uninitialized values

Tips

  • Use -g flag when compiling for debugging: gcc -g -o prog main.c
  • c-lint runs both cppcheck (bugs) and clang-tidy (style/modernization)
  • c-debug launches GDB — use run, break, next, print commands
  • CMake projects: create a CMakeLists.txt, then c-build handles the rest
  • Ctrl+Shift+B compiles and runs the current file

Security

  • Root access is restricted. Use sudo apt install <libname-dev> for libraries.
  • gcc, g++, clang, make, and cmake are whitelisted for sudo access.