Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux CSE 1222 CSE1222: Lecture 1BThe Ohio State University1.

Similar presentations


Presentation on theme: "Linux CSE 1222 CSE1222: Lecture 1BThe Ohio State University1."— Presentation transcript:

1 Linux CSE 1222 CSE1222: Lecture 1BThe Ohio State University1

2 CSE User Name Your CSE user name is 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. CSE1222: Lecture 1BThe Ohio State University2

3 Windows Password Your starting Windows password is: # # # # x x ! where # # # # are the last four digits of your OSU ID number and x x are your first and last initials. For example, if John Smith’s OSU ID number is 123456789, then his starting password is: 6789js! CSE1222: Lecture 1BThe Ohio State University3

4 CSE1222: Lecture 1BThe Ohio State University4 This is what your screen looks like when you log in to your CSE Windows account.

5 CSE1222: Lecture 1BThe Ohio State University5 Click on the icon on the left (not the one on the right) to switch to CSE Unix.

6 CSE1222: Lecture 1BThe Ohio State University6 Your CSE user name for Unix is the same as your user name for Windows.

7 Unix Password Your starting Unix password is: # # # # x x where # # # # are the last four digits of your OSU ID number and x x are your first and last initials. (Note: No “!” in the Unix password.) For example, if John Smith’s OSU ID number is 123456789, then his starting password is: 6789js CSE1222: Lecture 1BThe Ohio State University7

8 CSE1222: Lecture 1BThe Ohio State University8 Right click in the background and then select “Open in Terminal” to create a terminal window.

9 CSE1222: Lecture 1BThe Ohio State University9 Select the terminal window and type: xemacs first.cpp & to create your first program.

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 using namespace std; int main() { cout << "My first program in CSE 202!" << endl; cout << "My parents will be so proud." << endl; return 0; } CSE1222: Lecture 1BThe Ohio State University10

11 CSE1222: Lecture 1BThe Ohio State University11

12 CSE1222: Lecture 1BThe Ohio State University12 Select the “File” menu and “Save first.cpp” to save the file.

13 CSE1222: Lecture 1BThe Ohio State University13 Select the “File” menu and “Exit XEmacs” to leave emacs.

14 CSE1222: Lecture 1BThe Ohio State University14 Select the terminal window and type: g++ first.cpp a.out to compile and run your first program.

15 CSE1222: Lecture 1BThe Ohio State University15 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.

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’ > 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. CSE1222: Lecture 1BThe Ohio State University16

17 CSE1222: Lecture 1BThe Ohio State University17 Type: ls to list the files in your directory. The computer should list: a.out first.cpp

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 CSE1222: Lecture 1BThe Ohio State University18

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 202!" << 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. CSE1222: Lecture 1BThe Ohio State University19

20 CSE1222: Lecture 1BThe Ohio State University20 Type: g++ second.cpp a.out to compile and run the program second.cpp.


Download ppt "Linux CSE 1222 CSE1222: Lecture 1BThe Ohio State University1."

Similar presentations


Ads by Google