In this tutorial, we will discuss how can you set up an environment for compiling and execution of your code. C++ is a cross-platform programming language so different operating systems such as Windows, Linux, Mac OS, etc. support its compilers. To execute and run C++ code in any one of these Operating systems we need to install compiler in our local system. There are two ways you can compile your C++ code and execute it, either you can install a text editor and compiler Or you can install an IDE ( Integrated Development Environment ). Let’s discuss both options.
Setting the C++ environment in a local system
- Text Editor and Compiler:
- C++ IDE (Editor and compiler)
A text editor is an application or software you can install in your system to write the C++ code. The program you will write would be a simple file which extension should be “.cpp”. To write a C++ program you can install any text editor such as Nodepad++, Sublime, etc. even you can write C++ code in your system notepad and save the file with .cpp extension.
If you use a Text Editor to write C++ code, then you require a C++ compiler to compile that file into executable code or machine language so the program can run. There are various free compilers present on the internet, from where you can download any of the compilers and install it in your system. Some C++ compilers:
- Cygwin (GNU C++)
- MinGW (Minimalist GNU for Windows) – GCC version for Windows.
- Intel C++ for non-commercial development.
- Microsoft Visual C++ Express edition.
- Oracle C++
An IDE stand to Integrated Development Environment, it is also a software that consists of both the text editor and compiler. Instead of installing a text editor and compiler developer simply install an IDE that provides both the facility in one application. Some C++ IDE’s:
- Turbo C++
- Dev C++
- Visual Studio
We suggest you download either C++ turbo or Dev C++ to compile and execute the C++ code because they are the most popular lightweight and beginner-friendly IDE's. People are also reading: