CS@Mines Logo
CSCI 262: Data Structures Spring 2019

Help!

Asking for Help

First, try Piazza!
First, try Piazza!
First, try Piazza!

You might get help fastest via a classmate on Piazza. Your instructors will be looking at Piazza, too, and will usually respond fairly quickly. When you post on Piazza, please do not post complete programs or solutions; try to ask or answer questions without code first, or use only the smallest amount of code necessary to get your question or point across. We'll talk in class about incremental development of your code, which should help keep things in small chunks.

Once you've tried Piazza, if you still have questions, you can contact your instructor directly for help. You should also feel free to contact your instructor at anytime about any concerns which you aren't comfortable sharing on Piazza.

Looking for office hours? - these are posted on the course home page.

References

Here are some websites to keep handy while you are programming:

Getting Started with C++

Practice Problems

Need more practice, or just want to challenge yourself? Try Kattis!

CLion FAQ

What is the CMakeLists.txt file, and what should be in it?
CMakeLists.txt is a file that instructs CLion (really, a helper program named "cmake") how to build your program from source files. The file can get pretty complex, but for this course, your CMakeLists.txt should contain something like this:
          cmake_minimum_required(VERSION 3.0)
          project(myprogram)

          set(CMAKE_CXX_STANDARD 11)

          include_directories(.)

          add_executable(myprogram
              source1.cpp
              source2.cpp
              header1.h)
While CLion will usually create and manage CMakeLists.txt for you, there are many ways you might add a file to your project or remove a file from the project such that CMakeLists.txt doesn't get properly updated. To fix this, edit the list of files in the "add_executable()" portion of the file - inside the parentheses, the first argument needs to match the project name (set above using project()), the rest are your source and header files.

CLion is telling me that "This file does not belong to any project target" or similar. What's wrong?
This can happen if you add files to your project through some mechanism other than through CLion's interface (e.g., copying the file into the project directory using File Explorer). You need to make sure all of your source files are listed in the CMakeLists.txt file. See above.

Why am I getting the error message "CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.nn or higher is required. You are running version 3.mm"?
Most likely you created your project under a newer version of CLion, and are now trying to use it under an older version. Just modify the "cmake_minimum_required" line in CMakeLists.txt to
          cmake_minimum_required(VERSION 3.0)
and you should be fine.

My program is not printing anything from cout, or is only printing part of what I was expecting.
If you are on Windows, this may be a known issue. To fix it, on the top menus in CLion, select Help > Find Action. Search for "registry" and hit enter. Uncheck the box that says run.processes.with.pty. If you are on a campus lab machine, you may need to do this every time you run CLion. Sorry!

I'm getting a message, "Cannot continue with sh.exe on your path" or similar.
This seems to happen somewhat randomly on the campus lab machines. It is some kind of conflict with other software installed on the machine, but doesn't happen consistently. If/when it happens, do the following steps to work around the problem:
  1. Go to File > Preferences
  2. Expand Build, Execution, Deployment
  3. Select CMake
  4. In the CMake options: field, enter -DCMAKE_SH="CMAKE_SH-NOTFOUND"
  5. Hit Apply and Ok

CLion won't compile my project, and nothing above fixed my problem.
We've seen some instances where the CLion project files just seem to get corrupted, and CLion just won't build your project. This seems to happen most often when working over the network or with a flash drive. If you are completely stuck, there are a couple of ways to potentially get back on track. The easiest way is to close CLion, go to your project folder, and delete the "cmake-build-debug" and ".idea" folders. Restart CLion and re-open your project folder. CLion will create fresh versions of the deleted folders, and hopefully everything will start working again. Alternately, you can create a new project and copy your old source files into it - just be sure to edit your CMakeLists.txt file when you do this!