The g++ is a compiler (just as clang++), so it asks g++ to compile hello.cpp and generate an executable output, however, it uses -o flag to set the generated executable name to “ hello” instead of the default name“ a.out”. the second command was: g++ hello.cpp -o hello This is exactly what we did before, the tilde character (~) that we used in “ ~/Desktop” actually expands to your home directory (your home directory is “/Users/”UserName”/) then ( /Desktop) to get to your CPP file location. The first thing we notice is, it’s running the cd command cd /Users/"UserName"/Desktop Note: the & is used to run multiple commands in order, in one line. Installing the command-line tools will install the clang compiler and it is a requirement to develop C++ regardless of IDE/Editor you choose.
In part 3 I use CMake to work with large projects. Note: if you are familiar with VScode and C++ you may refer to the next part where I use tasks.json and launch.json for debugging and configuring your project. Or, set “stopAtEntry” in the launch.json file to true to stop at the beginning of calling the main function.We start from the ground, running the simplest C++ program, then we add more complex files, automate the tasks and explore VScode along the way. Set a breakpoint by clicking next to a line where you want to set a breakpoint. Make sure to add the path to the executable as follows: For example, in your lab1, that would be “Array”. This will create a launch.json file and open it up for editing.Ĭhange “program” to the program you intend to debug. Click on “create a launch.json file” and select “C++(GDB/LLDB)” from the environment menu selection. vscode on the left-navigation pane of the Explorer (Command+shift+e), enter Command+shift+d to enter into the “run and debug” set-up. Set a breakpoint or set the “stopAtEntry” to true.Make sure “C/C++ IntelliSense, debugging, and code browsing” extension is installed in the SSH remote machine.Debugging on VS Code involves the following steps: