Could someone recommend a C++ compiler to write programs on a linux platform. I am just looking to write some programs in the shell not really looking to do any X-windows programming right now.

Dani AI

Generated

As asked for a compiler for command‑line C++ work: the practical choices on Linux are GCC (the common default, as noted) or Clang. Either will build simple shell programs and both support modern C++ standards; Clang tends to give clearer diagnostics and integrates well with static tools, while GCC is the traditional, widely available toolchain. ’s reply demonstrates the basic compile/run flow for local development.

Quick setup and workflow tips: install your distro’s development meta‑package (Debian/Ubuntu: build-essential; Fedora/RHEL: the “Development Tools” group; Arch: base-devel). Use a small build system (Make or CMake) once you have more than one source file. Pick a C++ standard (for new projects start with -std=c++17 or later) and enable warnings (-Wall -Wextra) plus debug info (-g) for development; use optimizations and LTO for release builds.

Debugging and correctness tools: run a native debugger (GDB), memory checkers like Valgrind, and sanitizer builds (AddressSanitizer / UndefinedBehaviorSanitizer) to catch leaks and UB early. Add static analysis (clang‑tidy) and unit tests to your workflow so regressions get found before they hit production. See the language reference for details on standard features at cppreference, and sanitizer docs for how to use them at Clang AddressSanitizer. Valgrind info is at valgrind.org.

A note on the linux-kernel tag: the upstream Linux kernel is written in C and its build system and coding rules do not support C++ for in‑kernel code. For kernel experiments, stick to C and the kernel docs, or write user‑space tools that interact with kernel APIs (see kernel.org).

Recommended Answers

All 2 Replies

>Could someone recommend a C++ compiler to write programs on a linux platform.
GCC. It's probably already installed on your computer, too.

to compile some source just type in console:

g++ program.cpp -o program

program.cpp is your source code, and program is your compiled program, then run it with

./program

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.