-
Notifications
You must be signed in to change notification settings - Fork 236
#include<avr/io.h> error c_cpp_properties.json automatic generation bug #1507
Comments
Thanks for the report and workaround @al3x-huang! I'm having trouble reproducing this issue. Can you provide some extra information?
|
I'm having a similar issue. It seems that the chip define is missing from the defines, in my case adding |
After digging deeper it seems that cocopa does not pass |
I think it has to do with this issue: |
Yes, that's the same root cause |
VScode version:
1.67.2 (Universal) commit c3511e6
Arduino extension version:
v0.4.12
To use port manipulation on PORTA I am explicitly including <avr/io.h>. I am getting an include error
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit
on#include<avr/io.h>
.This seems to be a pain point as there are a number of other users who reported this problem. I finally found a
c_cpp_properties.json
configuration that fixes this problem:but every time, it kept getting overwritten by the Arduino extension and the automatically generated c_cpp_properties.json does not work. I discovered from #438 that this is now a feature since 0.4.0. However, the c_cpp_properties.json generation logic seems buggy from my struggle with this #include error.
(outdated, see edit below)

The current workaround is to disable the IntelliSense auto generation and use the above c_cpp_properties.json. For anyone else having this issue here's a screen shot of the setting:It would be great to see the automatic generation work though.
EDIT: I found a better workaround from #1279 that I'll include here for posterity...
You can have
c_cpp_properties.json
generated automatically initially by searching and runningArduino: Rebuild IntelliSense Configuration
inView->Command Palette
orcmd+shift+p
for mac. After this, check.vscode/arduino.json
to ensure a configuration with nameArduino
has been generated and also make sure C/C++..vscode/c_cpp_properties.json
should look something like the snippet below. If you don't get this make sure you don't haveArduino: Disable Intelli Sense Auto gen
checked/disabled in the extension settings.Make sure you use the configuration we just generated by searching and running

C/C++: Select a Configuration...
in command palette as above or alternatively clicking on the bottom bar as shown in this screenshotAt this point, most of your intellisense errors should be fixed but if you're using any IO port definitions you'll still get an error. To fix this, add a line to
defines
referencing your specific board under the Arduino C++ configuration. As of writing this edit, I am using an ATTiny85 and the definition is"__AVR_ATtiny85__"
. You can find a list of these defines at <avr/io.h>. So your.vscode/c_cpp_properties.json
should look something like this:Lastly, add
"intelliSenseGen": "disable"
to.vscode/arduino.json
to prevent your changes from being overwritten. Note that you need to set this to true if you need to update the generatedc_cpp_properties.json
configuration in the future.Your intellisense should now work!
The text was updated successfully, but these errors were encountered: