how to compile c++ programs in centos version
i am using linux-centos system to write c++ programs,but there is a problem with the compiling command.i use g++...command.but get an err msg "cammand not found"...can someone help me to understand why is the compiling command not responding in centos version. but the same command compiles in the open suse version.is it possible the compiler not to be installed properly in centos.pls explain.....
|
You need to install some packages. I think everything you need is included in the group of packages installed by the following command (as root):
yum groupinstall 'Development Tools' I don't currently have admin rights on any Centos system, so I can't check whether I got the syntax of that command right or whether there are any header or library files you will also need that might not be included in that group. If you google the command I suggested, you will see lots of pages that explain what it includes. Those pages probably will give you other info you will need. |
Have you checked, gcc is installed properly or not. If it is installed properly
Check gcc version using Code:
gcc -v 1) Write any C program in text editor and save as filename.c In following example, I have saved this file on my Desktop. 2) To run this program, you have to compile it first. Code:
This will generate a compile copy of your program as a name compiled-filename in same directory where you ran the above command. 3) Now create output copy of your program. Following command generate a output file of your program in same directory. Code:
Code:
Alternatively you can run compiled copy of your program. Example: http://2.bp.blogspot.com/-24QssOXJ0z...0/Untitled.png |
You can also do a
Code:
yum install gcc |
Quote:
after tat only am getting da error..!! |
Try
yum install gcc-c++ Quote:
I don't know Centos packages at that level of detail myself. So I did a google search, finding several places claiming the command I showed above is needed, implying the command you suggested is not enough. Quote:
|
No, # yum install gcc
... will install gcc only. |
If you have gcc installed, use
Code:
yum install cpp gcc cloog-ppl cpp glibc-devel glibc-headers kernel-headers mprf ppl I figured centos would do the same....I could be wrong though... **Some of these may install due to the specific subscriptions that I am using. |
for gcc and the needed programs the "groupinstall" i have found works best
yes it installs a lot but there is also a good chance you might also need the gnome development libaries and the basic dev libs the packages are not that big so --- for my SL6.3 install -- Code:
su - |
Quote:
|
Quote:
Install the development tools group. Without them c++ becomes useless as you won't have the necessary headers for various libraries, or the tools to help manage compilation (autoconf, make,...). Install any development libraries you will need (these are also included in a group). You CAN install each package separately, but by the time you get everything working (it will take a day or so to find you are missing "yet another...") that you save time by installing the groups. |
thanks
Quote:
|
All times are GMT -5. The time now is 05:42 PM. |