-   Linux - Software (
-   -   What are the commands to use to check whether the gcc compiler is working? (

babyswan 07-18-2007 08:23 PM

What are the commands to use to check whether the gcc compiler is working?
Hi there. I am doing a project on firmware and Linksys router. A intrusion detection device.
I was asked to use the gcc compiler to compiler codes.
However I am lost. I do not know how to use the gcc compiler at all. The internet research is not efficient enough.

Does anyone know what are the commands to test and check whether the gcc compiler is working?
How do I know whether the compiler is working? What are the commands to test that it works?
Do i also type the commands at the command shell prompt?
I hope someone replies me fast as no one is able to help me with this. I am feeling so stressed up right now because the project module points is a lot and I think i am failing this module.

Very much appreciated if some1 is able to help me! *sobz*

babyswan 07-18-2007 08:31 PM

when i type gcc at the command shell prompt, it says no gcc....what does this mean?
I have already installed the and i have already extracted it...isnt this the compiler??? I am so losttt as i do not have any knowlege of this.
helpppp !

babyswan 07-18-2007 09:02 PM

sorry there is a typo error above, what i mean is when i typed gcc at the command shell prompt, it says bash command not found, something like this.
I head that there is a need to install a package but where am i able to find this package and how does it work with the

I really hope someone will be able to help me with this because i am very worried right project deadline is in less than a mths time for now.

chadl 07-18-2007 09:18 PM

The best way to test GCC is to compile a simple C program. If the program compiled, then you know that GCC is working.

If you really want to install from a source tarball, the documentation for GCC is really well written...

Note that if you don't have any C++ compiler installed, then you will need to get a binary version of GCC, as you can't compile the source version of GCC without a compiler of some type. This is why I recommend using your distributions package manager. Binary versions for assorted platforms can be found at if you can't use your package manager for whatever reason.

If you want more detailed help, you will need to put your distribution in your profile. I use Gentoo, so I don't frequently deal with systems that don't have GCC installed.

YouWillNverWalkAlone 07-18-2007 10:21 PM

how m i going to know the distro?because i m using a linux machine from the school.

babyswan 07-19-2007 02:07 AM

hiii there thank you so much for respondinggg!!!!!

my distribution is redhat 9...
i am still unable to find the gcc package...
where am i be able to find this gcc compiler package and install it?
After that is there a need for further configuration?

lazlow 07-19-2007 08:43 AM

Support for Redhat9 was dropped more than four years ago. There are not updates available for it(of any kind). Your admin should update to a supported modern OS.

chadl 07-19-2007 07:35 PM

Do you have root on the box? If you don't, then you will not be able to install GCC (you can most likely run it, but it will be more complicated, esp if you are not sure about what you are doing in Linux). Because it is your schools system, chances are you will want to ask the System Administrator to install GCC.

If you do have root (and your system admin says its OK to install GCC), then you can install the RPM from the Red Hat 9 installation CD.

lazlow does have a point about RH9 being out of date; however. I would have said use the Red Hat FTP to get the latest version of GCC, but Red Hat has long since taken down the RH9 RPM FTP.

babyswan 07-19-2007 08:14 PM

Yes I do have root in the system.
But I do not have the redhat 9 cd.
So that means there is no way I can install gcc now?
What will you advice me to do?

jschiwal 07-19-2007 09:05 PM

You might try finding packages and their dependencies at If you can find one package, look at the link for that package. That will most likely be a repository that you can add and then use your package manager to download and install files.

chadl 07-19-2007 09:05 PM

Try installing this RPM:
Do your own due diligence before installing this, as I have no way to test this, but it looks like the RH9 GCC RPM to me.

To install an RPM (as root):

rpm -ivh <rpm file name>
EDIT: Updated to use the download site rather then the one I had found before. Thanks to jschiwal for finding that.

babyswan 07-19-2007 09:24 PM

i am facing problems in opening the link.
once i click on the above link it will say cannot find server.

babyswan 07-19-2007 09:26 PM

ohhh ok sorry i am able to download it to my desktop in the linux computer already thank u very much. I will update the situation soon!

babyswan 07-19-2007 09:36 PM

ok i am done with the installation of package thankx for the link. =)
Right now i am facing this problem:
when i type gcc at the command shell prompt, the output is as follows:

gcc: no input files

i am not sure what the above means.
But i have installed this file which i know that it is the source codes for it. I have already untar it but how am i going to use it with the gcc compiler?

chadl 07-19-2007 09:42 PM

That is the normal output for GCC if you don't give it anything to do. If you give it some code to compile, it will compile it instead of telling you that there are no input files.

To give it a test:
Put this code in a file named test.c:

#include <stdio.h>
int main()
        printf("Hello World!\n");
        return 0;

Then run the following to compile it:

gcc test.c -o test

If Hello World! is printed on your screen, then GCC is working correctly.

All times are GMT -5. The time now is 11:19 PM.