- Install C/C++ Extension for VS Code
- Select the working directory: in VS Code, File->Open Folder, select the directory for your code files.
- Edit tasks.json to compile the code:
> Tasks: Configure Task
> click Create tasks.json file from templates
> select Others.
Edit "label" and "commands" in tasks.json, here's the example:
Note: for GCC debug, -g option should be included to tell the compiler to generate extra info for debugging
- Modify launch.json to debug your code
Go to Debug -> Start Debugging, it will open the launch.json file.
Modify "program" tag and add "preLaunchTask" as the following example.
That's it. You can start debugging now...
沒有留言:
張貼留言