English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C++ Development environment configuration

Local environment settings

If you want to set up a C++ Language environment, you need to ensure that you have the following two available software on your computer, a text editor and C++ Compiler.

First, install GNU's C++Compiler

To install GCC on Windows, you need to install MinGW. To install MinGW, please visit the MinGW homepage www.mingw.org,go to the MinGW download page and then install it,

Add the bin subdirectory of the MinGW you installed to your PATH environment variables, so you can specify these tools by simple names in the command line.

1、Enter g++ --version to view the g++version, confirm whether the path is effective.

2、Enter: gcc -v. If the following information appears, it means that MinGW is installed correctly.

(1)Create a new text file in the folder, write the code into it, and change the file extension to .cpp

 

 

(2)Open the command line in the same directory, for example, a.cpp, input g++ a.cpp, since the executable program's filename is not specified in the command line, the compiler uses the default a.out. Therefore, a.exe is generated in the same directory.

 

(3)Enter 'a' and press Enter to run the command line input.

 (4)Generally we use -o option specifies the filename of the executable program, the following example generates an executable file named helloworld:g++ 1.cpp -o helloworld

 

 

Second, Visual Studio (Graphical Interface) Compilation

Use the Windows development powerhouse Visual Studio. This method is relatively simple, just download the latest VS installation.

1Open Visual Studio Community

2、Click File -> New -> Project

> Select Visual C++  --> Windows Console Application  --> Name (N): Project name, Location (L): Project storage location, fill in after, and click OK to create the project.

> Right-click in the source file to add--> Add New Item, Click C++> Fill in the name and location of the file (.cpp), then click OK.

> The source file is created

> Write the code in the source file

> Click on Debug in the menu -> Start Without Debugging (or press ctrl + F5) :

Run the First Code