Perform these steps in VS Code:
If you are on Windows, use Ctrl, instead of CMD.
- CMD-Shift-P -> "C/C++" -> C/C++: Edit Configurations (JSON))
- Copy the content below then in VS Code CMD-a to select all of the existing c_cpp_properties.json file
- CMD-v to paste and CMD-s to save.
The location of libraries will be different based on how gcc was installed. If you compiled gcc yourself (Option 3 on wellys.com), then use the first json file. If you used the default installation from Bookworm, use the second JSON file. VS Code will advise if it isn't able to find the library files.
{
"configurations": [
{
"name": "AVR",
"includePath": [
"/usr/local/avr/avr/",
"/usr/local/avr/include/**",
"${workspaceFolder}/**"
],
"defines": ["__AVR_ATmega328P__"],
"compilerPath": "/usr/local/avr/bin/avr-gcc",
"compilerArgs": [ ],
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
{
"configurations": [
{
"name": "AVR",
"includePath": [
"/usr/lib/avr/",
"/usr/lib/avr/include/**",
"${workspaceFolder}/**"
],
"defines": ["__AVR_ATmega328P__"],
"compilerPath": "/usr/bin/avr-gcc",
"compilerArgs": [ ],
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
If you are on Windows, use Ctrl, instead of CMD.
- CMD-Shift-P -> "task" -> Tasks: Configure Default Build Task _> Create...from template -> Others Example...
- Copy the content below then in VS Code CMD-A to select all of the existing tasks.json file
- CMD-v to paste and CMD-s to save.
{
"version": "2.0.0",
"tasks": [
{
"label": "make",
"detail": "Run make",
"type": "shell",
"command": "/usr/bin/make ${input:makeTarget}",
"options": {
"cwd": "${fileDirname}"
},
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"group": {
"kind": "build",
"isDefault": true
}
}
],
"inputs": [
{
"type": "pickString",
"id": "makeTarget",
"description": "Select a make target",
"options": [
{
"value": "flash",
"label": "compile and upload code (upload)"
},
{
"value": "compile",
"label": "only compile code (verify)"
},
{
"value": "clean",
"label": "remove non-source files"
},
{
"value": "complete",
"label": "complete re-compile with verbose upload"
},
{
"value": "verbose",
"label": "verbose upload to debug serial connection"
},
{
"value": "env",
"label": "print env variables being used"
},
{
"value": "help",
"label": "print make commands"
}
],
"default": " flash"
}
]
}