Computer Science, asked by pallavisingh54, 6 months ago

discuss the programming environment of c++​

Answers

Answered by aadishree7667
0

The source code written in source file is the human readable source for your program. It needs to be "compiled", into machine language so that your CPU can actually execute the program as per the instructions given. ... The following section explains how to install GNU C/C++ compiler on various OS

Explanation:

The C Compiler

The source code written in source file is the human readable source for your program. It needs to be "compiled", into machine language so that your CPU can actually execute the program as per the instructions given.

The compiler compiles the source codes into final executable programs. The most frequently used and free available compiler is the GNU C/C++ compiler, otherwise you can have compilers either from HP or Solaris if you have the respective operating systems.

The following section explains how to install GNU C/C++ compiler on various OS. We keep mentioning C/C++ together because GNU gcc compiler works for both C and C++ programming languages.

Installation on UNIX/Linux

If you are using Linux or UNIX, then check whether GCC is installed on your system by entering the following command from the command line −

$ gcc -v

If you have GNU compiler installed on your machine, then it should print a message as follows −

Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr ....... Thread model: posix gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)

If GCC is not installed, then you will have to install it yourself

This tutorial has been written based on Linux and all the given examples have been compiled on the Cent OS flavor of the Linux system.

happy independence day

Answered by thesonofkrishna
0

Answer: Setting up C++ Development Environment

C++ is a general-purpose programming language and widely used nowadays for competitive programming. It has imperative, object-oriented and generic programming features.

C++ runs on lots of platform like Windows, Linux, Unix, Mac, etc. Before we start programming with C++. We will need an environment to be set-up on our local computer to compile and run our C++ programs successfully. If you do not want to set up a local environment you can also use online IDEs for compiling your program.

Using online IDE: IDE stands for integrated development environment. IDE is a software application that provides facilities to a computer programmer for developing software. There are many online IDEs available which you can use to compile and run your programs easily without setting up a local development environment.

Explanation:      Setting up local environment

For setting up your own personal development environment on your local machine you need to install two important softwares:

1- Text Editor: Text Editors are type of programs used to edit or write texts. We will use text-editors to type our C++ programs. The normal extension of a text file is (.txt) but a text file containing C++ program should be saved with ‘.CPP’ or ‘.C’ extension. Files ending with the extension ‘.CPP’ and ‘.C’ are called source code files and they are supposed to contain source code written in C++ programming language. These extension helps the compiler to identify that the file contains a C++ program.

Before beginning programming with C++, one must have a text-editor installed to write programs

2-C++ Compiler: Once you have installed text-editor and typed and save your program in a file with ‘.CPP’ extension, you will need a C++ compiler to compile this file. A compiler is a computer program which converts high-level language into machine understandable low-level language. In other words, we can say that it converts the source code written in a programming language into another computer language which the computer understands. For compiling a C++ program we will need a C++ compiler which will convert the source code written in C++ into machine codes. Below are the details about setting up compiler on different platforms.

Linux Installation: We will install the GNU GCC compiler on Linux. To install and work with the GCC compiler on your Linux machine, proceed according to below steps:

You have to first run the below two commands from your Linux terminal window:

sudo apt-get update

sudo apt-get install GCC

This command will install the GCC compiler on your system. You may also run the below command:

sudo apt-get install build-essential

This command will install all the libraries which are required to compile and run a C++ program.

After completing the above step, you should check whether the GCC compiler is installed in your system correctly or not. To do this you have to run the below-given command from Linux terminal:

g++ --version

If you have completed the above two steps without any errors, then your Linux environment is set up and ready to be used to compile C++ programs. In further steps, we will learn how to compile and run a C++ program on Linux using GCC compiler.

We will run the above command as:

After executing the above command, you will see a new file is created automatically in the same directory where you have saved the source file and the name of this file is the name you chose as any-name.

Now to run your program you have to run the below command:

./hello

Similar questions