Sunday, January 16, 2011

How to compile goodbye.c?

The gritty details for compiling a program are in Appendix A. Assuming that you have thumbed through it already, use your powerful human memory to recall the proper command to compile and link the GOODBYE.C source code. Here’s a hint:
gcc goodbye.c -o goodbye

Type that command at your command prompt and see what happens. Well?

Nothing happens! If you have done everything properly, the GCC compiler merely creates the final program file for you. The only time you see a mes­sage is if you goof up and an error occurs in the program.

If you do get an error, you most likely either made a typo or forgot some tiny tidbit of a character: a missing “ or ; or \ or ) or ( or — you get the idea. Very carefully review the source code earlier in this chapter and compare it with what you have written. Use the editor to fix your mistake, save the code to disk, and then try again.


Note that GCC reports errors by line number, or it may even specifically list the foul word it found. In any event, note that Chapter 2 covers error-hunting in your C programs.

Welcome to reproduce this passage. Please indicate the source when you reproduce this passage.
Source: C Language 

No comments:

Post a Comment