2026年7月22日 星期三

Visual Studio Code(VS Code) tutorial


1. install VS code

    Download the corresponding version

    https://code.visualstudio.com/download?_exp_download=fb315fc982

    sudo apt install ./<file>.deb

Ref:

    https://code.visualstudio.com/docs/setup/linux

    https://code.visualstudio.com/docs/setup/windows


2. install extension for C/C++ or other

    Start app

    Enter extensions and install: C/C++, C/C++ Extension Pack, C/C++ DevTools, Bookmarks by Alessandro

Ref:

    https://code.visualstudio.com/docs/languages/cpp


3. first program(Hello World) and do debug

    Please check the under link.

    .vscode -- some setting file

        tasks.json (compiler build settings)

        launch.json (debugger settings)

        c_cpp_properties.json (compiler path and IntelliSense settings)

    Debug: 

        a. Open main.cpp in VS code.

        b. Add a breakpoint in source code

        c. Press the play button(in the right-up location),  select Debug C/C++ File in the drop-down

Ref:

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


4. Debugging with Multiple Files

    Previous step will generate tasks.json. Modify task.json.

    Replease

    "${file}",

    to

    "file1.cpp",

    "file2.cpp",

Ref:

    http://antares.cs.kent.edu/~csi/blog/vscodemultiple.html



沒有留言:

張貼留言