Question
Please provide typescript file from question 3 below: Learn how to use a text editor on the Linux machines. You can pick whichever one you
Please provide typescript file from question 3 below:
Learn how to use a text editor on the Linux machines. You can pick whichever one you want. Some commonly used editors are vim, joe, or emacs. Any of these are good choices if you have not used one before. Read the man (manual) page describing the editor either directly on the Linux machine (e.g., >man vim) .
Now use your editor to create a very simple program. The contents of the file are given below. Name the file hello.c.
#include
#include
int main() { '
printf(hello world );
exit(0); }
Now compile your program using the gcc compiler. You can compile it using this line: gcc hello.c o hello.
Now run the program using this command: hello (or possibly ./hello if your path does not include the current directory.)
Questions:
1. Read (or perhaps skim) the man page on gcc. You may use other C compilers on Linux if you prefer (e.g., g++). a) State which compiler you used. Explain how you b) link in a library. (Note this is not the same as including an include file.)
2. Read the tutorial on make files above. a) What is the purpose of makefiles? b) Give a simple example makefile which you could use to compile your program by typing make.
3. Change the hello program to print out your name. Type script to begin recording all output. Type "cat hello.c" to display your program code. Now recompile your new program and run it. Type exit to end the recording session. The output file is called typescript. Use the WINSCP file transfer program or another FTP program to transfer your file from the Linux machine to your home machine. See the class announcements for a pointer to WINSCP.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started