C++ Development Environment Setting up

C++ Development Environment Setting up

C++ Development Environment Setting up. C++ is a general-purpose programming language that is commonly used in competitive programming nowadays. It contains features for imperative, object-oriented, and generic programming.

C++ is compatible with a variety of operating systems, including Windows, Linux, Unix, and Mac. Before we begin programming in C++, there are a few things to consider. To build and run our C++ applications effectively, we’ll need to set up an environment on our local computer. If you don’t want to set up a local environment, you may compile your application using online IDEs. Also visit Best Quantum Computing Workshops & Conferences To Attend In 2021.

Using an online IDE (integrated development environment)

IDE stands for integrated development environment. IDE stands for Integrated Development Environment, and it is a piece of software that allows a computer programmer to build software. There are a plethora of online IDEs that you may use to build and run your programmes without having to set up a local development environment.

Geek4Geeks offers an IDE called ide.geeksforgeeks.org.

The application may be launched by clicking the Run on IDE button.

using namespace std;
    cout << "Learning C++ with Geek4Geeks";

Creating a local setting

Two vital softwares must be installed on your local system in order to build up your own personal development environment:

C++ Development Environment Setting up
C++ Development Environment

1st. Text Editor:

A text editor is an application that allows you to edit or compose texts. Our C++ applications will be written in text editors. A text file’s standard extension is (.txt), however a text file containing a C++ programme should be saved with the extension ‘.CPP’ or ‘.C’. Source code files are files with the extensions.CPP and .C that are meant to contain source code written in the C++ programming language. These extensions aid in the compiler’s recognition of the file as containing a C++ application. To develop programmes in C++, you must first have a text editor installed. Must visit Facebook Reveals Name Change to Meta – Facebook Rebranding.

2nd. Compiler for C++:

You will need a C++ compiler to build this file once you have installed text editor and entered and saved your programme in a file with the ‘.CPP’ extension. A compiler is computer software that transforms high-level language into low-level code that machines can understand. To put it another way, it translates source code written in a programming language into a computer language that the machine can comprehend. A C++ compiler is required to compile a C++ programme because it converts the source code written in C++ into machine code.

The following sections provide information on how to set up a compiler on various platforms.

  • GNU GCC Compiler Installation on Linux: We’ll install the GNU GCC compiler on Linux. Follow the instructions below to install and operate with the GCC compiler on your Linux machine:

To begin, open a Linux terminal session and perform the following two commands:

  • GNU GCC Compiler Installation on Linux: We’ll install the GNU GCC compiler on Linux. Follow the instructions below to install and operate with the GCC compiler on your Linux machine:
  • To begin, open a Linux terminal session and perform the following two commands.
  • The GCC compiler will be installed on your machine using this command. You may also use the command below:
    sudo apt-get install build-essential
  • This command will download and install all of the libraries needed to compile and run a C++ application.
  • After finishing the preceding step, verify that the GCC compiler is appropriately installed in your system. To do so, open a Linux terminal and type the following command:

    g++ –version
  • If the preceding two procedures were performed without problems, your Linux environment is now set up and ready to create C++ programmes. We’ll learn how to compile and run a C++ programme on Linux using the GCC compiler in the following stages.
  • Create a text file for your programme and save it with whatever name you choose. Extension of the CPP. We wrote a programme to show “Hello World” and stored it on the desktop as “helloworld.cpp.”
  • Now you must open the Linux terminal and navigate to the location where your file was stored. Then, to build your file, execute the following command:

    g++ filename.cpp -o any-name
  • The name of your source code file is filename.cpp. The name in our example is “helloworld.cpp,” and any-name may be any name you choose. The executable file generated by the compiler after compilation will be given this name. We chose any-name to be “hello” in our example.
  • We’ll run the programme as follows.

    g++ helloworld.cpp -o hello
  • When you run the above command, you’ll see that a new file is generated automatically in the same directory where you stored the source file, with the name you specified as any-name.

    Now you must use the following command to run your programme:
  • In the terminal window, this command will run your application.
  • Windows Installation: There are a variety of integrated development environments (IDEs) for Windows that you may use to work with the C++ programming language. Code::Blocks is one of the most popular IDEs. This link will take you to a page where you may download Code::Blocks. Open the Code::Blocks setup file you got from the supplied URL and follow the instructions to install it.
  • Once Code::Blocks is installed, go to File menu -> Select New and create an empty file.
  • Now, in this empty file, create your C++ programme and save it as a ‘.cpp’ file.
  • Go to the Build menu and select the Build and Run option after saving the file with the ‘.cpp’ suffix.
  • Mac OS X Setup: If you’re a Mac user, you’ll need to get Xcode. To obtain Xcode, go to the Apple website or search for it in the Apple App Store. You can get Xcode by going to developer.apple.com/technologies/tools/. There are all of the essential installation instructions there.
  • Open the Xcode application when it has been successfully installed.
  • To start working on a new project. Go to the File menu, then New, then Project. You will be given a new project as a result of this.
  • Following, select a template for your project in the next box. Choose the Application option from the OS X area on the left side bar to select a C++ template. Now choose command-line tools from the drop-down menu and click the Next button.
  • In the following window, fill in all of the required information, such as the organization’s name, the product’s name, and so on. However, be sure you choose C++ as the language. After you’ve completed the form, click the next button to move on to the next stage.
  • Select the place where you want your project to be saved. Then, from the directory list on the left sidebar, choose the main.cpp file.
  • Now, when you open the main.cpp file, you’ll see a pre-written c++ programme or template. This software may be changed to suit your needs. To execute your C++ application, go to the Product menu and select Run from the dropdown menu.

Follow us at FACEBOOKWHATSAPP, and TELEGRAM for more Exciting Tech updates and News.

Leave a Reply

Your email address will not be published. Required fields are marked *