Welcome to CS106B! This assignment is designed to help you get your development environment set up and running so that you can compile, run, and debug programs. There isn’t any actual programming involved, and we hope that this doesn’t take you too much time to complete. Remember, you don’t need to understand what the code you’re being asked to run is actually doing just yet. Over the course of the quarter, each of the different parts of this program will be illuminated! This assignment must be completed individually.
Step 1) Install Qt Creator
Your first task is to configure your computer for Qt Creator, the development environment that we’ll be using in CS106B this quarter. Follow the instructions in the Qt Installation Guide for your operating system.
If you run into trouble installing Qt Creator, don’t panic! Yasmine will be holding a Qt Creator help session in CoDa B45 from 7:00PM – 9:00PM PDT on Thursday, September 25th. If you run into issues, you can also post on Ed Discussion forum and we can help you out there.
Step 2) Download starter project
We will configure a starter project with the files needed for each assignment and post it in the form of a ZIP archive. Download the archive and extract all. Double-click the NameHash.pro file to open the project in Qt Creator.
Step 3) Hash your name
Open the project in Qt Creator and build and run the program. It will ask you to enter your (preferred) first and last names. When you do, it will give back a hash code, a special number associated with your name. You can think of your hash code as a “fingerprint” associated with your name that’s unlikely to be the same as anyone else’s fingerprint. Write this number down; you’ll need it to complete the assignment!
Step 4) Use the debugger
Open the debugger tutorial. This wonderful guide written by Keith Schwarz walks you through using the debugger on the Name Hash program. Follow along with the step-by-step instructions. At some point, you’ll be asked to remember a number. Write this number down; you’ll need it to complete the assignment!
Step 5) Read about the Honor Code
You are required to read our handout CS106B and the Honor Code before submitting assignments. Do this now before proceeding to the final step.
Step 6) Submit
Once you’ve finished everything, fill out the form at the following URL:
- 📋 Submit Google form: https://forms.gle/2etf8kDh9rWshLAq9 (you must be logged into your Stanford Google account to access the form)
This form will ask for the numbers from Steps 3 and 4, along with some questions about who you are, why you’re awesome, and what your learning environment will look like this quarter. And that’s it! You’re done!
Fix: Qt Downgrade Instructions for Windows Users
We’ve seen repeated occurrences of Windows users encountering unexpected crashes with Qt projects (often when trying to run the debugger) that we have otherwise been using without incident for several quarters. This appears to be related to a bug in the latest version of the compiler that Qt is using on Windows. The solution we’ve found is for Windows users to downgrade to an older version of Qt that uses a more reliable version of the C++ compiler.
If you’re a Windows user who is encountering crashes that occur with our starter code for various assignment – not crashes that are introduced by the code you add to those assignments – or if you’re unable to proceed through the debugging warmups in our assignments without encountering unexpected crashes or insurmountable technical glitches, you need to switch to an older version of Qt.
Special thank you to Sean Szumlanski for putting together this guide, to Julie Zelenski and Michael Chang for helping us get to the root of the issue, and to SLs Luke Andrews and Adam Lambert for helping us verify that these fixes work for Windows users.
Instructions
Follow the steps below to downgrade to version 6.7.3 of Qt (and version 11.x.x of the MinGW compiler). This should resolve the SIGSEGV error you may have been seeing!
Step 1: Downgrade to Qt 6.7.3
- Open the Qt Maintenance Tool (not the Qt Creator). You can find this program by typing qt maintenance in the Windows Start menu.
- If you’re prompted to update the Qt Maintenance Tool, follow the instructions to do so before proceeding.
- Click “Submit” to sign in and “Next” to get to the next screen.
- Select “Add or remove components” and click “Next.”
- In the menu that comes up, click the triangle next to “Qt” (not “Qt Creator”).
- Completely un-check the “Qt 6.9.x” and “Qt 6.8.x” options.
- Those checkboxes might have a “-” in them currently. Click once to change those to a checkmark, and a second time to clear the boxes entirely.
- Click the triangle next to the “Qt 6.7.3” option.
- Under “Qt 6.7.3,” check off the following options:
- MinGW 11.x.x (not version 13.x.x!)
- Qt Quick 3D
- Qt Shader Tools
- Qt Quick Timeline
- Click the triangle next to “Additional Libraries” to expand that menu, and check off the following:
- Qt Charts
- Qt Multimedia (this one is super essential!)
- Under “Qt 6.7.3,” check off the following options:
- Scroll down and click the triangle next to “Build Tools.”
- Be sure MinGW 13.x.x is not checked.
- Check off the following:
- MinGW 11.x.x (not version 13.x.x!)
- CMake 3.30.5 (or whatever version is available)
- Ninja 1.12.1 (or whatever version is available)
- Click “Next” and then “Update” to begin updating the Qt Creator.
Step 2: Reinstall the Stanford C++ Libraries
⚠️ Do not skip this step!
- After the Qt updates are complete, download and open a totally fresh copy of the CS106 libraries package that you ran earlier on in Assignment 0 while setting up Qt. When you open this project, before clicking “Configure Project,” check that the configuration says your Qt version is 6.7.3. If not, you might need to uninstall the Qt Creator through the Qt Maintenance Tool and then reinstall from scratch with the options given in the bulleted list above.
- Select Build > Clean from the Qt Creator menus to be absolutely sure we’re working with a fresh build of this program.
- Run the program and get to the welcome screen that displays the Stanford logo. (Compiling and running this program re-builds the Stanford C++ libraries on your computer using your current compiler, which should make things Just Work™ moving forward.)
Step 3: Check That the Starter Code Behaves as Expected
- Download and open a totally fresh copy of the starter code you were trying to run.
- Compile and run the project with no modifications. (Do not modify any code!)
- Continue where you left off trying to work on the assignment. Hopefully, you will no longer get the SIGSEGV error you were seeing before! If the program crashes with a SIGSEGV error, select the Build > Clean option from the Qt Creator menus and try again, just to be sure. If it still crashes after that, then this process was not successful, and we recommend heading to Yasmine’s Qt Installation Session or Chris’s OH for help resolving this issue.
Step 4: Reconfigure and Rebuild Existing Projects
⚠️ Do not skip this step, either!
Now that you’ve updated Qt and your compiler, it’s critical that you reconfigure and rebuild any existing Qt projects you’re working with.
If possible, we recommend downloading a totally fresh copy of any starter code you’re working with. For any project where that’s not feasible, be sure to do the following:
- Open the folder where your project resides and delete the following:
- the build folder
- the
.pro.user file (but not the .pro file!)
- Open the project in the Qt Creator. Before clicking “Configure Project,” check that the configuration says your Qt version is 6.7.3.
- Just to be extra safe, select the Build > Clean option from the Qt Creator menus before compiling and running your project.