1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See...
-
Upload
nathaniel-long -
Category
Documents
-
view
234 -
download
0
description
Transcript of 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See...
![Page 1: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/1.jpg)
1
Getting Started with C++
Part 2Linux
![Page 2: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/2.jpg)
2
Getting Started on Linux
Now we will look at Linux.
See how to copy files between Windows and Linux
Compile and run the “Hello, World” program on Linux.
Try out a very simple editor on Linux.
![Page 3: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/3.jpg)
About Circe All USF students have access to a Linux
system known as Circe.
Try logging in with your USF NetID. (Details follow.)
If unsuccessful, you should be able to get access at rc.usf.edu If unsuccessful there, please contact the USF
IT Help Desk. 974-1222
3
![Page 4: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/4.jpg)
Connecting to Circe Use an SSH terminal client program
to connect to Circe. Recommended client program is
PuTTY Can download from http://www.putty.org/
You will also need an SSH file transfer program.
Recommended client program is WinSCP Can download from
https://winscp.net/eng/download.php4
![Page 5: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/5.jpg)
Connecting with PuTTY
5
Click Open
![Page 6: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/6.jpg)
Using Circe
6
Your Net ID
Your Net ID Password
Command Prompt
![Page 7: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/7.jpg)
Create a Test Directory
7
![Page 8: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/8.jpg)
8
Copying a File to Circe Use an SSH file transfer program to
copy the C++ source file to your test directory on Circe. Recommended program: WinSCP
![Page 9: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/9.jpg)
WinSCP WinSCP gives you a window on your
desktop that looks and acts like a normal Windows folder.
You can drag and drop between the WinSCP window and a Windows folder in either direction.
9
![Page 10: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/10.jpg)
10
Connecting to Circe with WinSCP
Click Login
![Page 11: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/11.jpg)
Connected to Circe
11
![Page 12: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/12.jpg)
12
Connected to Circe
Initially at your home directory.Your contents will be different.
![Page 13: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/13.jpg)
13
Open your test directory
Double click on your test directory to open it.
![Page 14: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/14.jpg)
Open your project directory Locate and open your Visual Studio project
directory By default it is in your “My Documents” folder
under Visual Studio 2015\Projects C:\Users\Rollins\Documents\Visual Studio 2015\
Projects\hello Drill down to hello.cpp
14
![Page 15: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/15.jpg)
Copy hello.cpp to Circe
15
Drag hello.cpp from your Visual Studio project directory window into the WinSCP window and drop it.
![Page 16: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/16.jpg)
Copy hello.cpp to Circe
16
![Page 17: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/17.jpg)
17
In the PuTTY Terminal Window
Look at the file
Compile and link
No response from g++ means that it was successful.Your executable file is named a.out
![Page 18: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/18.jpg)
18
Run It
![Page 19: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/19.jpg)
19
Creating a Source File on CirceDelete existing files. We will start from scratch.
nano is a very simple text editor.
![Page 20: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/20.jpg)
20
Creating a Source File on Circe
Whatever you type into this window will be written to the output file.
![Page 21: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/21.jpg)
21
Creating a Source File on Circe
Press Ctrl-o to write out the file.
![Page 22: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/22.jpg)
22
Creating a Source File on Circe
Press Enter to write contents of window to hello.cpp
![Page 23: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/23.jpg)
23
Creating a Source File on Circe
Press Ctrl-x to exit from nano.
![Page 24: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/24.jpg)
24
Exit from the Editor
![Page 25: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/25.jpg)
25
View the Source File
![Page 26: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/26.jpg)
26
Compile and Run
![Page 27: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/27.jpg)
27
The Manipulator endl
#include <iostream>
int main( void ) { std::cout << "Hello, World!";
std::cout << std::endl;
return 0;}
std::endl is not a character like '\n'It is an instruction to cout to start a new line.
Referred to as a manipulator.
![Page 28: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/28.jpg)
28
Multiple outputs with cout
#include <iostream>
int main( void ) { std::cout << "Hello, World!" << std::endl;
std::cin.get(); return 0;}
<< operators can be cascaded as many times as you wish.
![Page 29: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/29.jpg)
29
Input from the Keyboard#include <iostream>
int main( void ) { int a; int b; std::cout << "Enter two integers to compute their sum:" << std::endl;
std::cin >> a; std::cin >> b;
std::cout << "The sum of " << a << " and " << b << " is "; std::cout << a + b << std::endl;
return 0;}
![Page 30: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/30.jpg)
30
Input from the Keyboard
![Page 31: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/31.jpg)
31
Avoiding all those "std::"s#include <iostream>
using namespace std;
int main( void ) { int a; int b; cout << "Enter two integers to computer their sum:" << endl;
cin >> a; cin >> b; cout << "The sum of " << a << " and " << b << " is "; cout << a + b << endl;
return 0;}
![Page 32: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/32.jpg)
32
Being More Selective#include <iostream>
using std::cin;using std::cout;using std::endl;
int main( void ) { int a; int b; cout << "Enter two integers to computer their sum:" << endl;
cin >> a; cin >> b; cout << "The sum of " << a << " and " << b << " is "; cout << a + b << endl; ... return 0;}
This is generally considered better practice.
![Page 33: 1 Getting Started with C++ Part 2 Linux. 2 Getting Started on Linux Now we will look at Linux. See how to copy files between Windows and Linux Compile.](https://reader035.fdocuments.us/reader035/viewer/2022062306/5a4d1b0f7f8b9ab05998dbca/html5/thumbnails/33.jpg)
33
Assignment
Before next class Be sure you can connect to Circe
and log in using your USF NetID. Do today’s examples for yourself
if you didn’t do them in class. Read Chapters 1 and 2.
End of Presentation