[4 Oct 2023]

Preliminaries

There is something called an "execution path" - the sequence of folders that the computer will look into to find a command when you ask it to execute that command.
On Unix (Linux, MacOS), you can check what your execution path is by typing into a terminal:
echo $PATH

On Windows, it depends on whether you're running:

You need to know this so you can debug cases where the computer claims a command does not exist (maybe its folder isn't included in the path).

(you also need to know this so that you know how to use a computer... See The Missing Semester of Your CS Education from MIT.)

Getting access to command-line tools

By default, your account does not have access to any command-line compilers. Check your execution path - does it contain at the end something like "Winlibs_GCC_MingGW_Eclipse"? If not, we need to gain access to that.
Another way to check is to simply try to run "g++ --version" on a terminal and see if it works or it complains of not knowing what g++ is.

Request Eclipse for C++

To get access to command line tools, we need to start Eclipse for C++ through AppsAnywhere.

AppsAnywhere can be accessed on a lab machine by starting the Edge browser. Usually they're the first page that shows - if not, there should be a bookmark with that name.

Search "Eclipse" in the AppsAnywhere search field and start the one for C++.

Now, close any cmd (or powershell) window you may had opened to check your path and open a new one - check your path again; the folder should be present.

Type "g++ --version" - I get:

g++ (MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
So, we now have access on the command line to a C++ compiler (g++), a debugger (gdb), and make (called mingw32-make).

The compiler and the debugger work out of the box but mingw32-make needs a bit of convincing to work correctly. The issue is that it thinks that it's installed in a different folder than it actually is (AppsAnywhere uses containers that probably explains this), so tries to find the compiler in there. For example, if I move into a directory that has file hello.cc and type "mingw32-make hello", I get:

>mingw32-make hello
D:/Prog/winlibs64_stage/mingw64/bin/x86_64-w64-mingw32-g++.exe     hello.cc   -o hello
process_begin: CreateProcess(NULL, D:/Prog/winlibs64_stage/mingw64/bin/x86_64-w64-mingw32-g++.exe hello.cc -o hello, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [: hello] Error 2

> 
mingw32-make thinks that the compiler is "D:/Prog/winlibs64_stage/mingw64/bin/x86_64-w64-mingw32-g++.exe" but it isn't.

How can we tell it what the compiler is and where it'll find it? We can do so by adding a file called "Makefile" in our folder (where hello.cc exists). Running "mingw32-make hello" again should compile your file and produce an executable called "hello" (OK, this being Windows it'll be called "hello.exe"). You can execute it by typing (without the double quotes): ".\hello"

How did the Makefile solve the problem? It defined make's variable CXX, so that it points to the correct compiler, in the correct folder. It also defined make's variable CXXFLAGS, so that make knows what flags to pass to this compiler ("-g" is particularly important - it's needed to tell the compiler to add extra information that helps while debugging).

Using the Eclipse IDE

To use the Eclipse IDE itself, you must start a new C++ project (cannot just open a C++ file with it, it'll *not* work). How?
"File -> New -> C/C++ Project" Now, select the second option "C++ Managed Build" and press on Next>. On this screen, provide a name for your project and make sure to choose MinGW GCC on the right! Add a new file in the project that has the same name as your package (e.g., "testing.cc" if your package is called "testing"), and write some C++ code in it:
#include 
int main() {
  std::cout << "Hi!\n";
  return 0;
}
      
Save the file (Contol-s), then select "Project -> Build All" (or just press Control-b), then press the Run button and choose "Local C/C++ Application".

Remember to save your code before asking the IDE to re-build it.