Monday, December 10, 2018

Setup Visual Studio Code on Ubuntu for C++ Debugging

  1. Install Visual Studio Code
  2. Update CMake to 3.7 or above
    1. "cmake --version": Check cmake version with execution of "cmake --version" on terminal. The following steps can be skipped if the version is 3.7 or above
    2. Visit https://cmake.org/download/ and download the latest binaries, eg. cmake-3.12.4-Linux-x86_64.sh
    3. "chmod +x /path/to/cmake-3.12.4-Linux-x86_64.sh" (use your own file location here, chmod makes the script executable)
    4. "sudo apt remove cmake": Remove existing version of cmake
    5. "sudo /path/to/cmake-3.12.4-Linux-x86_64.sh" (you'll need to press y twice)
    6. The downloaded cmake package will be found in directory "cmake-3.12.4-Linux-x86_64". You could consider to move the cmake package into /opt with "sudo mv /path/to/cmake-3.12.4-Linux-x86_64 /opt". This step is optional.
    7. If you have moved the package under "/opt", create soft link with "sudo ln -s /opt/cmake-3.12.4-Linux-x86_64/bin/* /usr/local/bin". If you have not, create soft link under "/usr/local/bin" for the cmake binary tools in your desired directory.
  3. Install following Visual Studio Code Plugins
    • "C/C++" from Microsoft
    • "CMake" from twxs
    • "CMake Tools" from "vector-of-bool"
References:
  1. https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu

No comments:

Post a Comment