Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout << "Hello, world\n"; return 0; } Task: run “Hello World” program.

Similar presentations


Presentation on theme: "1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout << "Hello, world\n"; return 0; } Task: run “Hello World” program."— Presentation transcript:

1 1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout << "Hello, world\n"; return 0; } Task: run “Hello World” program on Unix/Linux Important note: If you finish the program, Please show me for grading. Then, you can do some exercises in Chapter3 or help others.

2 2 Step0 Claim your CSE account You need claim your CSE account before LAB if you didn’t do that before: https://helpdesk.cse.tamu.edu/index.php/Claiming_You r_Computer_Science_Accounts

3 3 Step1 Connect to server (for window) 1. Open PuTTY Type “build.tamu.edu” in Host Name and click open. 2. Login with your NetID

4 4 Step1 Connect to server (for MAC) 1. Open a terminal and type in command: ssh –Y [your_NetID]@unix.cse.tamu.edu 2. type in your password to login to the server 3. then, you can type ssh –Y build Note: -Y means graphical use

5 5 Step2 write your “Hello World” 2. Create and open“helloworld.cpp” in vim 3. Press “i” or “a” to enter Insert Mode 4. After entering source code, press “Esc”, exit to Command Mode 5. Type “:wq” to save and quit

6 6 Step3 add header (for Windows) 1.Map your CSE H: Drive https://wiki.cse.tamu.edu/index.php/Mapping_y our_CSE_H:_Drive https://wiki.cse.tamu.edu/index.php/Mapping_y our_CSE_H:_Drive 2. Open your server folder in your local computer 3. Copy “std_lib_facilities_4.h” into the same folder with helloworld.cpp http://courses.cse.tamu.edu/daugher/misc/PPP/std _lib_facilities_4.h

7 7 Step3 add header (for Mac) 1.Use wget command to download header file on build server Wget http://courses.cse.tamu.edu/daugher/misc/PPP/std_lib_facilities_4.h Note: make sure the header file is at the same folder with helloworld.cpp

8 Step3 Compile and run the program The compile command on build is g++ -std=c++14 helloworld.cpp or use command g++ -std=c++14 -Wall -Wextra -pedantic helloworld.cpp for additional syntax checking. Run the program./a.out

9 Basic vi Commands vi filename edit file i start inserting text ESC stop inserting text ZZ save and exit ENTER go down one line - go up one line dd delete line 0 go to beginning of line SPACE go right one character x delete character


Download ppt "1 Lab 2 “Hello world” in Unix/Linux #include "std_lib_facilities_4.h" int main(){ cout << "Hello, world\n"; return 0; } Task: run “Hello World” program."

Similar presentations


Ads by Google