1 / 21

Linux

CSE 1222. Linux. CSE User Name. Your CSE user name Assigned by the CSE department It is NOT the same as your OSU user name You should have received your CSE user name in e-mail sent to your OSU account If you don’t have your user name, see me. Windows Password.

Download Presentation

Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 1222 Linux The Ohio State University

  2. CSE User Name • Your CSE user name • Assigned by the CSE department • It is NOT the same as your OSU user name • You should have received your CSE user namein e-mail sent to your OSU account • If you don’t have your user name, see me The Ohio State University

  3. Windows Password • Your starting Windows password is: # # # # xxp! • # # # # are the last four digits of your OSU ID number, xx are your first and last initials (lower case), and don’t forget the p and ! For example, if John Smith’s OSU ID number is 123456789, then his starting password is: 6789jsp! The Ohio State University

  4. This is what your screen looks like when you log in to your CSE Windows account The Ohio State University

  5. Click on the icon on the left (not the one on the right) to switch to CSE Unix The Ohio State University

  6. Your CSE user name and password for Unix is the same as your username and passoword for Windows The Ohio State University

  7. Right click in the background and then select “Open in Terminal” to create a terminal window The Ohio State University

  8. The UNIX command prompt is now waiting for you to type in a command to execute • You want to familiarize yourself very quickly with the most common UNIX commands (ls, cp, mkdir, etc.) The Ohio State University

  9. Select the terminal window and type: xemacs first.cpp & at the command line to create your first program The Ohio State University

  10. Program first.cpp Select the xemacs window and enter the following text exactly as shown below: // File: first.cpp // Created by: Your name // Created on: Jan. 3, 2012 #include <iostream> using namespace std; int main() { cout << "My first program in CSE 1222!" << endl; cout << "My parents will be so proud." << endl; return 0; } The Ohio State University

  11. The Ohio State University

  12. Select the “File” menu and “Save first.cpp” to save the file The Ohio State University

  13. Select the “File” menu and “Exit XEmacs” to leave emacs The Ohio State University

  14. Select the terminal window and type: g++ first.cpp a.out at the command line to compile and run your first program The Ohio State University

  15. Important Note: If you forgot the “&” in “xemacs first.cpp &” and did not exit emacs, then nothing will happen when you type the command “g++ first.cpp”. • Your terminal window is waiting for you to close the emacs window • Select the “File” menu and “Exit XEmacs” to leave emacs. The Ohio State University

  16. Compiler (g++) errors If you did not type the program in exactly as in slide 10, you may get an error message after typing “g++ first.cpp”. For example, if you forgot quotation marks on line 10, the following would happen: > g++ first.cpp first.cpp:10:39: warning: missing terminating " character first.cpp:10: error: missing terminating " character first.cpp: In function ‘int main()’: first.cpp:10: error: ‘My’ was not declared in this scope first.cpp:10: error: expected ‘;’ before ‘first’ > • Is this a syntax error or logical error? Why? • Error messages are often hard to understand; • The most useful part of the error message is the line number (in this case 10) which tells you where the compiler detected the error. The error is usually in this line or in the line just preceding it. • Try to correct your program to match exactly the code in slide 10. The Ohio State University

  17. Type: ls to list the files in your directory. The computer should list: a.out first.cpp The Ohio State University

  18. Copying a file Type: cp first.cpp second.cpp to create a copy of first.cpp which is called second.cpp Type: ls to again list the files in your directory The computer should now list: a.out first.cpp second.cpp The Ohio State University

  19. Creating second.cpp Type: xemacs second.cpp & to edit the program second.cpp. Be sure to remember the “&” • Modify the lines: cout << "My first program in CSE 1222!" << endl; cout << "My parents will be so proud." << endl; in second.cpp so that they print your name and your favorite food. • Modify only the text between the double quotation marks • Be sure not to delete the double quotation marks • Select the “File” menu and “Save second.cpp” to save the file • Select the “File” menu and “Exit ” to save the file The Ohio State University

  20. Type the following two commands (at two separate prompts of course): g++ second.cpp a.out to compile and run the program second.cpp The Ohio State University

  21. Tutorials • UNIX • http://www.cse.ohio-state.edu/~weide/sce/reference/unix • XEmacs • http://www.cse.ohio-state.edu/~weide/sce/reference/xemacs The Ohio State University

More Related