(Optional) Installing a C++ IDE and Compiler on your own PC
Steven Zeil
1 Local Development
We have previously looked at options for developing code remotely, where the compiler and/or the IDE ran on a remote machine. Although that is a perfectly good option for most coursework, many students prefer to do local development, where the compiler and IDE reside on their own PC. Among other things, this allows students to work while offline.
Both Eclipse and VSCode can be easily installed on your own PC. Installing your own copy of a C++ compiler is slightly more complicated, but not terribly so.
Advantages:
- If you have a good PC, this is fast and responsive.
- You don’t need a good Internet connection. You may not need to be on-line at all.
Disadvantages:
- If your PC is slow, your tools will be sluggish.
- There’s lots of software to install on your PC, taking up a good chunk of your hard drive.
- You are responsible for keeping your local copy of the compiler up-to-date.
If your compiler is a different version than the one used by the instructor, you may sometimes get very different results. It’s possible that code that compiles on your PC will not compile for the instructor, or vice versa.
-
If your operating system is different than the one used by the instructor, your compiled code may behave differently for you than it does for your instructor.
- More advanced classes may require you to additional code libraries in your programming assignments. It will be up to you to install those libraries on your local PC.
This information on local development is provided as a convenience for students wanting to explore other options. For the assignments in CS252, you must use one of the remote compiling options we have covered in the earlier lessons.
All of the configurations I discuss below can be set up free of charge.
1.1 For students with Windows PCs
There are two sources I recommend for the C++ compiler and toolset.
-
The Windows Subsystem for Linux (WSL) is a Microsoft official product, a Linux virtual machine that runs, pretty much seamlessly, on a Windows 10 machine. It pairs nicely with VSCode, which treats it like it was simply a remote Linux machine.
- Toolset: Linux g++, gdb, make, git
- IDE: VSCode
Installation instructions are here.
-
Cygwin is a Unix (technically, POSIX) emulator layer that runs in Windows 11 and older Windows operating systems. It can pair with either Eclipse or VSCode.
You might notice that I do not recommend any configuration based on Code::Blocks, which you may be familiar with from your beginning programming classes. There are good reasons for this. It will be common in more advanced programming projects to have more than one executable program produced in a single project, and Code::Blocks does not cope well with such projects. Additionally, the MinGW compiler favored by Code::Blocks is not easily extended by the addition of pre-compiled code libraries, another common feature of more advanced projects.
1.2 For students with MacOS PCs
For MacOS PCs, you will use the clang compiler rather than GNU g++. The two compilers share a lot of the same “front-end” code, however, so you will usually find they behave very similarly, even issuing identical error messages when encountering compilation errors.
* Toolset: clang c++, ilb, make, coreutils
* IDE: VSCode
Installation instructions are here.