A C++ project structure for compiling, debugging, and running C++ code using Visual Studio Code on Unix machines.
- g++ 9.3.0
- GNU Make 4.2.1
- VSCode 1.49.0+
If you would like to reuse libraries across projects, add the following line to your ~/.bashrc
. Otherwise, include the libraries in the local lib/
folder.
export CPP_LIB="/path/to/your/cpp/libraries/"
Now either close and open your terminal or run source ~/.bashrc
to sync the updates.
First, unpack the Eigen
folder from the ZIP download on the Eigen website into either the lib/
or CPP_LIB
folder.
Then you can open VSCode like this:
code .
Open main.cpp
and press F5
. This will start the debugger and you can step through your code.
If you want to run an optimized version, you can choose the g++ Release
, which will build the O2
optimized version of the main.cpp
file.
You can run either mode without using the debugger with Ctrl+F5
.
- Phil Thomas, CICS, Umass Amherst - C++ introduction as part of CS 687
- Dave for the
tasks.json
structure - This Duke U. page on Makefiles.
vcpkg
makers at Microsoft for making the automated library management possible
For more information, check out