How to compile and run a C++ program?

#include <iostream>

int main() {
    std::cout << "Hello, C++!\n";
}
Terminal

$ g++ -std=c++23 -Wall -Wextra hello.cpp -o hello
$ ./hello
Hello, C++!

The steps inside are: preprocessing, compiling, assembling and linking. See C++ Installation and Setup.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.