Setting Up C++ Environment
⏱ Estimated reading time: 1 min
To run C++ programs, we need a compiler and a text editor or IDE.
1. C++ Compiler
A compiler translates C++ source code into executable programs.
Common compilers:
-
GCC (g++)
-
Clang
-
Microsoft Visual C++
2. Windows Setup
Using MinGW
-
Download and install MinGW / MinGW-w64
-
Select the g++ compiler during installation
-
Add the MinGW
binfolder to the Path environment variable -
Verify installation using:
Using Visual Studio
-
Install Visual Studio
-
Select Desktop Development with C++
-
Compiler and IDE are installed automatically
3. Linux Setup
Most Linux systems support GCC by default.
Install GCC:
Verify:
4. macOS Setup
Install Xcode Command Line Tools:
Verify:
5. IDEs and Editors
-
Code::Blocks
-
Dev-C++
-
Visual Studio
-
VS Code
6. Compiling and Running a Program
Create a file:
Compile:
Run:
-
Windows:
hello -
Linux/macOS:
./hello
7. Online C++ Compilers
-
Programiz
-
OnlineGDB
-
Replit
Conclusion
After installing a compiler and editor, the C++ environment is ready to write, compile, and execute programs.
Register Now
Share this Post
← Back to Tutorials