last updated 2015/09/20
In order to program your assignments, you'll need to download and install Qt Creator, the editor we'll be using in CS 106B. Based on your operating system (Windows, Mac, or Linux) you'll need to follow different instructions. Please make sure to follow the instruction closely. We'll be hosting a Qt Creator Workshop (date/time TBA) to address any individual problems with installation.
Once you've installed Qt Creator, you can download any of the assignment projects available on the assignment page.
Note that to open the project, you have 2 options:
1) Open Qt Creator. Go to File->Open File or Project...
then navigate to the project you wish to open and click on the .pro file i.e. Life.pro or Tile.pro. Note, if you open the *.h files or *.cpp files instead it will not open the entire project.
2) Navigate to the project you wish to open in your file system, then just double-click on the .pro file i.e. Life.pro. This will open Qt Creator for you with this project.
Below is a screenshot of what Qt Creator should look like when you open a project.
Let's breakdown what buttons are where and how you actually edit and run the code. First in the picture below is the view menu. This menu allows you to change how qt creator will look which can help you in different tasks. You'll mainly use the Edit view and the Debug view. Projects will open in Edit view.
The files inside of this project will be displayed in the project files window which can be seen below. Note, if you can't see this window, hold down the alt key and press zero (the number key) on Windows or the meta key and press zero on Mac. The code files for the project can be found in the Header->src folder and the Sources->src folder. The files in the lib/StanfordCPPLib folders are the code files for the Stanford Library which includes the Vector, Grid, and Map classes. Feel free to open up these files and take a look. Just make sure not to change them since your assignments will be graded with a clean copy of those files.
But how do you run your programs? First, you'll need to build the project by clicking the Build button which is marked by the hammer icon in the picture below. If the project builds, then you can run the project by clicking the play button which is the plain green triangle button shown in the picture below. If you want to debug your project, you should click the debug button which is the green triangle with a bug on it shown in the picture below. Note, your project must be built in debug mode in order to debug your program. You can change the build mode by clicking the computer icon shown in the picture below and selecting the debug option. Most projects by default are built in debug mode.
The last thing to mention is where to view compiler errors, issues, and application output. At the bottom of your screen, you'll see the Issues, Application Output, and Compiler Output options. You can open these windows to see the corresponding information. Sometimes the explanations in the Issues window is not that helpful. In these cases, you should look at the Compile Output or Application Output to see if that gives you more helpful information.
If you have having trouble finding bugs in your program or just want to learn how to debug with Qt Creator's Debugging Tools, here's a handout for you.Debugging Handout
To write C++ programs for CS 106B, you need a C++ compiler and a text editor. Generally the compiler and text editor are combined into a single installed piece of software called an Integrated Development Environment (IDE). We will be using an IDE named Qt Creator, which is compatible with all major operating systems. The directions for setting it up vary slightly based on your operating system.
Check this link for a list of common QT issues and their solutions:
You are expected to follow the Stanford Honor Code.
Remember that we run similarity-detection software over all solutions, including this quarter and past quarters, as well as any solutions we find on the web.
If you need help solving an assignment, we are happy to help you. You can go to the LaIR, or the course message forum, or email your section leader, or visit the instructor / head TA during office hours. You can do it!