Introduction to Software Lab
Teague Sterling & Gurgen Tumanyan
Week 0 — Spring 2010
Instructors
Office: SCI 252 (Next to Comptuer Science Under Grad. Lab)
Course Structure
- Two hour per Week Course
- Typical Class:
- Beginning of Class
- Attendance and quick questions.
- Lecture
- Review and expand on materials covered in CSC 210.
- Sometimes we will introduce new concepts (Nothing too crazy).
- Project Work
- A short project focusing on the topics discussed.
- Feel free to do Computer Science homework instead.
- Questions
- Don't hesitate to ask about homework & projects for other CS classes. That's what we're here for.
Requisite Software
- Need a compiler to create C++ programs
- We recommend NetBeans
- Other options:
Getting Started with Netbeans
- Download Netbeans
- Download/Install Cygwin (Windows Users Only!)
- Install Netbeans
Run Netbeans
That was easy. No? If you had problems the next few slides should help.
Did it Work?
- Open "cygwin" from the icon on the desktop and type
g++. - If the computer responds
g++: no input files or something similar all should be good. - If you get something drastically different or cygwin does not open then we have problems.
E-mail us or come to office hours if things are broken, otherwise continue on.
Setting Up NetBeans
- Open the NetBeans, and in the "Tools" menu click on "Options".
- Click on "C/C++" icon. You should see the "Build Tools" tab.
- Click then "Add" on the left. You should see "Add new tools collection".
- Click "Browse" and go to you cygwin installation directory (typically: C:/cygwin/)
- Select the "bin" subdirectory and click OK button. You should see "Cygwin" in Tool Family drop down box; click OK
- The fields on the right filled should be filled out and along with anew entry in the left hand list. Select this and set it as the default.
Did it really Work?
At this point, try to build your project by clicking the hammer icon in the upper panel. If everything's cool you'll see "Build Successful" message in the output window.
Now run your program by clicking the green "Play button". If a black window opens saying "Hello World", then congrats :-D. (Don't worry for now if there is other junk in the window).
If anything else happened please come to office hours so we can help get you up and running.
Makin' Programs
- Computer programs are written in simple text (source code) files.
- Source files are compiled into runnable programs.
- As programs grow, they span across many files.
- To stay organized (and maintain sanity), we can create projects.
Projects are not at all required, but will make your life easier later on.
Creating a Project
- Click "File" ยป "New Project"
- Select "C/C++" under "Categories" and "C/C++ Application" under "Projects". Click Next
- Give the Project a unique name. Let's call it "HelloCSC211"
- Change the Project location if you feel so inclined
- Make sure "Create Main File" is checked with "C++" selected in the drop-down menu.
- Click "Finish"
Working with Projects
- Your "HelloCSC211" project should be open now, if it isn't open it with the "File" menu.
- Find the "Source Files" tree on the left side of the window; expand it.
- Open the "main.cpp" file.
- You now see source code. Pay no attention to it!
- ERASE EVERYTHING IN THE TEXT EDITOR!
- Last but not least: Don't get scared when you see the next slide...
Writing Your First Program
Type the following in the text editor:
/* Project: HelloCSC211
* File: main.cpp
* Author: <YOUR NAME HERE>
* Created: January 27, 2010 2:30 PM
*/
#include <iostream>
using namespace std;
int main () {
cout << "Hello, World!" << endl;
return 0;
}
Compiling Your First Program
- If that was scary, take a breath.
- Save your project using the "Save All Files" icon, or just press Control-S
- Look for the "Run Project" Icon. It looks like a little green play button.
- Now click it.
- Your program should pop up and greet you.