This document provides a quick summary of some tricky C++ errors that show up regardless of your operating system.
If you find yourself in a "confusing, yet definitely not working state" there are a few steps you can take to try and fix things. You should review the other possible issues before trying this, but this process can help you out if something is wrong and you don't know how to fix it.
Find the folder which contains the assignment in question -- lets say the assignment folder is called "Life"
build-Life-Desktop_Qt_5_1_1_MinGW_32bit-Debug
Life/
resources/
StanfordCPPLib/
# .cpp and .h files
Life.pro
Life.pro.user
Close out of Qt Creator and remove the folder beginning with "build" along with the "Life.pro.user" file. Then, open the project file in Qt Creator again and it will re-build the project from a fresh start.
Right now, Qt Creator will highlight all uses of Stanford's foreach loop as an error. The code will still compile, but the editor will put a red line under it as if it was wrong.
This can be ignored, or students can use C++11 range-based for, the standard C++ syntax for looping over the elements in a container:
Vector<int> v;
// Add things to v
// this
foreach (int x in v) { ... }
// becomes
for (int x : v) { ... }
Sometimes you may see a grey screen with nothing on it when you open a project:
This isn't a problem -- it just means that you've closed the sidebar and now you can't open a file. You'll want to reopen the sidebar by clicking "Window -> Show Sidebar". You may need to select "Projects" in the sidebar to get the full list of all files in your project.
If a user loads a single .cpp file by opening it straight from the filesystem, Qt Creator will look something like this:
Instead of opening files by clicking on the .cpp file, you should always load files by clicking on the .pro. You can solve this by reopening the .pro and then opening the .cpp file from there.