VS code software code compilation

  1. After downloading the VS code software, you need to make some settings

Download some useful plug-ins: C/C++, C/C++ (reuse code blocks), C/C++ Advanced Lint (C/C++ static detection), Code Runner (code running), Chinese (Simplified Chinese), Rainbow Brackets (rainbow flowers) brackets), GBKtoUTF8 (convert GBK to UTF8), vscode-icons (VS code icon plug-in, mainly the icons of each folder under the resource manager), TabNine (an AI automatic completion plug-in)

  1. Start the VS code software ---code on the terminal. (Start in the corresponding directory)
  2. When opening a C++ project file, you need to add a configuration file

The first method: The "Quick Repair" function will be displayed at the red header file, choose to edit the "includePath" setting, set it in the Miscroft C/C++ extension, and select "/usr/bin/gcc" for the compiler path . Add the path to the corresponding header file in the include path

Second method: press ctrl+shift+p, enter C/C++: edit configuration (JSON), and select

VS code debugging official documentation

https://code.visualstudio.com/docs/cpp/config-linux

https://code.visualstudio.com/docs/cpp/cmake-linux

In fact, whether it is a plug-in or a compiler, gcc/g++ is ultimately called for compilation, and gdb is ultimately called for debugging. So we can compile it in the terminal and debug C++ and Ros programs by giving the absolute path and parameters of the executable program in the launch file.

There are several json files: c_cpp_properties.json (compiler path and IntelliSence settings)

tasks.json(compiler build settings)

launch.json(debugger settings)

Guess you like

Origin blog.csdn.net/tangling1/article/details/132185732