ANY program you want to run on a department machine, you should compile on a department machine. DO NOT transfer the executable file from one machine to another. It is best to recompile the code. Suppose you have a file hello. Type the following on the command line gcc hello. Now do ls and you will see a file called a. By default, gcc places the executable into this file, overwriting any existing file of the same name.
You specify the name of your executable, say hello by the following line: gcc hello. Question : I would like to understand the basics of how to write, compile and execute a C program on Linux OS. Make sure C Compiler gcc is installed on your system Make sure gcc is installed on your system as shown below.
Compile the helloworld. This will create the a. Execute the C Program a. Rich Hunter September 4, , am. Hello again. Ramesh Natarajan September 4, , pm. Thanks a lot for pointing out the issue. Anonymous October 25, , pm. Raj January 16, , am. Balajilp March 15, , am. Ehan Chang April 5, , pm.
In the Gnome interface to Solaris, you can get a terminal by clicking the right mouse button on the background and selecting new terminal. Type commands in the terminal window. Type the enter, or carriage-return, key to cause a command to be run. You might have used an integrated development environment that is a collection of several tools in one package. It is something like a stereo that contains a tuner, amplifier, cd player, etc.
We will use separate components instead, like a stereo that is built from separate components. The first component that you will need to use is a text editor. A text editor is used for creating all kinds of textual documents, not just programs. The system text editor is a simple editor similar to notepad in Windows. It should be self-explanatory. To open a file, either use open or drag the file into the text editor.
There is a quite old Unix editor called vi. To use vi to edit file foo. You are on your own to learn how to use this editor. Command man vi will show a manual on using vi. An alternative is emacs. Emacs is a large, versatile and extensible text editor.
0コメント