LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   gcc compiler (https://www.linuxquestions.org/questions/linux-newbie-8/gcc-compiler-4175472581/)

trackstar2000 08-08-2013 12:53 AM

gcc compiler
 
Hello,

I installed the compiler using yum.

yum install gcc

Is that all I need? The programmer said he is having issue :(. OS is centos 6.4 The compiler is good for C/C++? I did a 'which cc", its there also. I noticed its a link to gcc.

thelinuxist 08-08-2013 01:28 AM

What issues he has? gcc itself only contains the C compiler, I think the C++ one is in a seperate package (But maybe I am wrong, I use fedora). If the C++ compiler is installed as well, maybe a library is missing?
Remember that for building things, you usually need the developer version of a package (like "lib*-dev", please don't use THIS as a yum install parameter, it's probably gonna screw up your system!) and the normal version for running it afterwards.
To test whether GCC works, you can use the following:
Code:

echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'

(copied from http://www.linuxfromscratch.org/lfs/...gcc-pass2.html). If this tells you that there is no a.out, the compiler isn't working. Usually, it should tell you that:
Code:

Requesting program interpreter: /lib/ld-linux.so.2
allowing for /lib/ to be /lib64/ on a 64 Bit OS.

Good hunting for that error.

colucix 08-08-2013 01:43 AM

Usually you need some other tools as the GNU linker ld, the make utility, and so on... You can install all the basic development stuff by means of
Code:

yum groupinstall "Development Tools"

knudfl 08-08-2013 03:07 AM

Quote:

yum install gcc
A standalone gcc is not supposed to work.
None of the required tools / headers are installed.
The minimum is : # yum install gcc-c++
This will also install {glibc-devel glibc-headers kernel-headers},
i.e. the packages that will make up a functional gcc.

More tools : See #3 : # yum groupinstall "Development tools"
Please check the naming with $ yum grouplist
.. Used to be "Development Tools".
Now it's most often the lower case T : tools

-

trackstar2000 08-08-2013 11:00 AM

Quote:

Originally Posted by knudfl (Post 5005401)
A standalone gcc is not supposed to work.
None of the required tools / headers are installed.
The minimum is : # yum install gcc-c++
This will also install {glibc-devel glibc-headers kernel-headers},
i.e. the packages that will make up a functional gcc.

More tools : See #3 : # yum groupinstall "Development tools"
Please check the naming with $ yum grouplist
.. Used to be "Development Tools".
Now it's most often the lower case T : tools

-

The programmer said if he runs gcc it seems to be expecting a C++ file. I will install both.

yum install gcc-c++
yum groupinstall "Development Tools"


I am guessing no reboot is needed? I am going to test the compiler out myself.
Thanks,
ts

trackstar2000 08-09-2013 12:58 AM

Just a quick update.

I was able to test the Hello world sample (http://www.network-theory.co.uk/docs...ccintro_9.html) with the C language, but not C++ until I installed (yum install gcc-c++). I also went ahead and installed (yum groupinstall "Development Tools").


All times are GMT -5. The time now is 01:15 PM.