Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

installing gcc on linux box running fedora

Hey eveyerone

Can someone help i am trying to install a complier on my linux box but when i download the gcc i untar it and go to the directory and try to buid it by runnning ./configure but get a wiered message

./configure
Configuring for a i686-pc-linux-gnuoldld host.
Created "Makefile" in /usr/bin/gcc/gcc-3.0.4 using "mt-frag"
/tmp/cNf23397/cNf23397.pos: line 7: cc: command not found
*** The command 'cc -o conftest -g conftest.c' failed.
*** You must set the environment variable CC to a working compiler

what is this can anyone help here

thanks
[620 byte] By [nedo72] at [2007-11-11 10:06:57]
# 1 Re: installing gcc on linux box running fedora
cc is the C compiler and CC is the c++ one (case sensetive) -- in some text file out there in some poorly named folder, you have to change the a line to tell the system to use whatever compiler you already have so you can install the new version. Unless you tampered with the fedora install, you already have g++ or gcc on that system.

Alternately, just replace the cc with g++ in that file (makefile or whatever it was).

I am no expert but I think g++ is a wrapper for many, many compilers including gcc? Either way, fedora should have a version of both and the preferred call is to g++.
jonnin at 2007-11-11 20:59:20 >
# 2 Re: installing gcc on linux box running fedora
ok is see thanks for the info but if i try to search it whereis gcc there is a folder is that i cant get it to make file

also do i have to link it somehow CC to the make file and how the **** do you do that

Now gcc is a compiler as far as i can understand does it need anything else prior to running and installing the compiler
nedo72 at 2007-11-11 21:00:26 >
# 3 Re: installing gcc on linux box running fedora
gcc/g++ should stand alone (they rely on system libs and whatnots but these should exist and be set up if the compiler is present, which it will be unless you forcibly removed it during linux setup) -- all you should have to do is invoke g++ with all the source files and the include folder. However, most downloaded stuff needs a makefile to define non code things like environment vars and defines, so you often end up having to deal with the make mess.

you dont have to define cc as g++, but you *should*. I do not know how, there are 200 million little text files in linux that define how the OS does things, you have to find the right one and edit it. This is where you will have to look up the answer on a linux group.

Unfortunately, a new install generally requires a prior install, as gcc is written in c or c++ and so you need a compiler to compile the new version... or you will have to locate a binary package for it that matches your hardware/OS version.

However, g++ or gcc really, really should already exist. try making a hello world c++ program and then try
g++ hello.cpp
and you should get a binary file named a.out that you can execute (type a.out and it should run and print hello world) ... if you can do that, you already have a c++ compiler. Try it with gcc as well, same thing, if neither work, your ... in for a difficult time.
jonnin at 2007-11-11 21:01:30 >