790 Part VI . Programming in Linux Listing (Medical web site)

790 Part VI . Programming in Linux Listing 29-2: Header file for newhello Helper Function /* * msg.h - header for msg.c */ #ifndef MSG_H_ #define MSG_H_ void prmsg(char *msg); #endif /* MSG_H_ */ Listing 29-3: Definitions for newhello Helper Function /* * msg.c - function declared in msg.h */ #include #include msg.h void prmsg(char *msg) { printf( %sn , msg); } The command to compile these programs to create newhello is $ gcc msg.c main.c -o newhello To create the object files individually, you might use the following commands: $ gcc -c msg.c $ gcc -c main.c Then, to create newhello from the object files, use the following command: $ gcc msg.o main.o -o newhello When you run this program, the output is: $ ./newhello Hi there, programmer! Goodbye, programmer!
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply