GCC compiler (c++ compilation)
I am completely new to linux.
Here are few doubts that have been crawling in my mind as per what i have read, GCC-is a GNU Compiler Collection which can compile c codes. but for compiling c++ codes, we need g++. according to my knowledge CPP is a pre-processor but i have been told that cpp is a compiler as well, is it true? if yes then, can we use cpp to compile c++ codes? as in, can we use commands like this: cpp abc.cpp the way we compile .c files (gcc abc.c) i am using following version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) g++ is a part of gcc, but tough gcc is installed, i am unable to see g++ installed. even if we have cpp, do we need to install g++ or any other c++ compilers? |
As far as I know, cpp is only a preprocessor and not a compiler.
You still need to install g++ to compile C++ programs. The package you need to install will likely be called gcc-c++ or gcc-g++, but check your distribution's package management system (presumably yum or something, since it looks Red Hat based). |
Quote:
another question is can cpp be used for compiling c++ codes(according to following concept)? cpp converts C++ files onto a format readable by gcc, n then we can use gcc to compile this converted file. is this concept of CPP correct (CPP is called using #; and cpp basically includes the contents of header files)? |
Read about the Preprocessor here:
http://gcc.gnu.org/onlinedocs/cpp/ Read about cpp here: http://linux.about.com/library/cmd/blcmdl1_cpp.htm |
Quote:
|
Most welcome, Pallavi, if those links have cleared your doubt, mark the thread solved.
|
All times are GMT -5. The time now is 03:58 AM. |