1 lab 2 “hello world” in unix/linux #include "std_lib_facilities_4.h" int main(){ cout
TRANSCRIPT
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
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_Your_Computer_Science_Accounts
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
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
Step2 write your “Hello World” 2. Create and open“helloworld.cpp” in vim 3. Press “i” or “a” to enter Insert Mode4. After entering source code, press “Esc”, exit to Command Mode5. Type “:wq” to save and quit
6
Step3 add header (for Windows)1. Map your CSE H: Drive
https://wiki.cse.tamu.edu/index.php/Mapping_your_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.cpphttp://courses.cse.tamu.edu/daugher/misc/PPP/std_lib_facilities_4.h
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
Step3 Compile and run the program
• The compile command on build isg++ -std=c++14 helloworld.cppor use commandg++ -std=c++14 -Wall -Wextra -pedantic helloworld.cpp
for additional syntax checking.• Run the program
./a.out
Basic vi Commands
• vi filename edit filei start inserting textESC stop inserting textZZ save and exitENTER go down one line- go up one linedd delete line0 go to beginning of lineSPACE go right one characterx delete character