Resources for CS 2040
Installing Ruby, C++
Additional resources for C++
- An Overview of the
C++ Programming Language by Bjarne Stroustrup, the creator of
C++.
- Replit C++
Environment: a simple way to run short C++ programs, especially
if you are having problems on your computer.
- cplusplus.com: a great
reference for C++. If you don't understand what this site is saying,
review the relevant terms in the textbook; this site assumes readers
generally understand C++.
- Caution! Stack Overflow (SO) is a dangerous resource for this
course: many suggestions there do not apply to the type of C++ code you
should be writing for CS 2040. On the other hand, SO at least generally
contains factual information; there are high-profile sites that provide
no additional information beyond what you can find explained more clearly
in your textbook.
Fixing C++ Problems
- C++ Compiler errors and fixes
- Debugging 201: Debugging memory
faults in C++ such as random runtime errors, segmentation faults,
and even infinite loops.
- My program runs on my machine but not esubmit: This means you
have a memory fault; see the previous bullet.
- How do I submit input to a running program on my machine?
In the VM, press Control-D to mark the end of the input (end of
file). You may need to press the Enter key after this.
- My program doesn't have any output in the VM. Try submitting
to esubmit; it can happen that the VM breaks. If the program has output
on esubmit but not the VM, the simple thing is to reinstall the VM. You
can also ask your instructor for help on debugging the problem.
Virtual Machines (VMs) and Fixing VM Problems
- Using Codelite
- If opening files is not working in CodeLite:
- Right click on your project and select Settings...
- In the General group, scroll down to Working
Directory and set it to
$(WorkspacePath)/
. Then, press
the tab key.
- If you have not done so, select the Compiler tab and
set C++ Compiler Options
to
-g;-O0;-Wall;-std=c++17
. Again, press
the tab key.
-
You might go back and check the Working Directory in
the General tab - it is very easy to not save your changes.
- Click OK
You can now place the files in the top level directory of the
workspace. That is, if your workspace is named myspace
, put
your files in the same folder that contains myspace.workspace
.
- Setting up a git repository on your VM
- Fixing virtual machines (VMs) that are laggy or otherwise running
slowly: Start by ensuring your laptop has sufficient battery power.
Windows throttles the CPU on low power and this is very
noticeable on a virtual machine. Next, check for any updates using Lenovo
Commercial Vantage and Windows Update. Install all updates; this
may require multiple reboots followed by more checks. Check that your
Windows disk drive is no more than around 90% full; a very full drive
impacts the memory management system. Finally, reboot your laptop if it
has not been rebooted recently. This will eliminate any runaway processes.