GNU CC Compiler

only for RuBoard - do not distribute or recompile

GNU C/C++ Compiler

Two version of the GNU c/c++ compiler exist. The standard one installed with Red Hat is the egcs compiler. It is a fairly new rewrite of their old standby, gcc.

Both the gcc and the egcs compilers are of high quality. Either one can be used for our project. I assume you have the egcs compiler installed. If you don't, don't worry about it. The project will work exactly the same way.

Verifying GNU C/C++ Installation

To verify the installation of the compiler, bring up a terminal window and enter the following:

 [root@lin root]# gcc gcc: No input files 

The egcs compiler is a bit terse in some circumstances. If you enter gcc --help, you will get over a screen full of information. To find the version of egcs you are using, run the rpm query command. Your version should be the same as mine or higher:

 [root@lin root]# rpm -q egcs egcs-1.1.2-24 

Testing the Compiler

To verify the compiler is working as you expect, you need to create a small file and compile it. Use the "Hello World!" example found in beginning C instruction manuals. Bring p a text editor, enter the following lines, and then save it as test.c.

 #include <stdio.h> main() {   printf("Hello World!\n</"); } 

Press Enter after the end of the last line. After saving the file, run the following commands to test the compiler and your work:

 [root@lin root]# gcc test.c -o test  [root@lin root]# ./test 

Output

 Hello World! 

The first time I tried this, I had misspelled stdlib.h as stlib.h. The compiler spit out an error message, and I had to try it again. If you get an error, look carefully at your typing and reread the previous example.

If you get the "Hello World!" printout, you are ready. You have now verified the compiler is properly installed and the basic libraries are installed and working.

If you enter the commands as shown, and get the response "bash: gcc: command not found", you don't have the compiler installed. If you get an error indicating a header file could not be found, or there was a library problem, you either have a damaged egcs or gcc install, or a damaged Red Hat installation.

If you get any of these errors, first try removing and installing the egcs package. If that does not work, I suggest redoing the Red Hat install, and selecting the development packages.

only for RuBoard - do not distribute or recompile


MySQL and PHP From Scratch
MySQL & PHP From Scratch
ISBN: 0789724405
EAN: 2147483647
Year: 1999
Pages: 93
Authors: Wade Maxfield

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net