You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
The project that I am working on brings in the SPI.h header that is part of the standard Arduino distribution. This header uses the GCC-specific __attribute__() macro in several places, which causes IntelliSense to trip up and report nonsense errors in my project, since MSVC appears not to understand it.
If I modify c_cpp_properties.json to use the AVR-GCC compiler provided in the Arduino distribution, using the same command-line options that are used in the compilation process, and set intelliSenseMode to gcc-x64, I get much more sensible IntelliSense output. Since Arduino projects are always compiled using the Arduino AVR-GCC toolchain, and MSVC chokes on GCC-specific macros in official Arduino headers such as SPI.h, shouldn't this be the default value populated in c_cpp_properties.json for new projects, rather than MSVC?
The c_cpp_properties.json that I am using to make Intellisense work in my project (on a Mega2560 board) is as follows. Note that I have also modified the include paths; I can't remember what the reasoning behind them was, except for that I ran into issues with the default hardware\arduino\avr\** and tools\** paths at some point, and restricting the include paths to specific directories got things working again.
I used the above code to get the vscode-arduino extension working so it shows intellisense and error highlighting. I have a detailed write up of what exactly I did to get it to work at the following location:
It is basically the code from above but I detail how to use the Arduino IDE to get the 'compilerPath' needed for different Arduino boards (such as the Nano).
Thanks for posting the above, I spent quite a while trying to figure out how to get errors and intellisense working with my Arduino code and this was the suggestion that finally got it all working.
This issue has been automatically marked as stale and closed because it has not had recent activity. Please feel free to open a new issue if you would like further discussion. Thank you for your contributions.
The project that I am working on brings in the
SPI.h
header that is part of the standard Arduino distribution. This header uses the GCC-specific__attribute__()
macro in several places, which causes IntelliSense to trip up and report nonsense errors in my project, since MSVC appears not to understand it.If I modify
c_cpp_properties.json
to use the AVR-GCC compiler provided in the Arduino distribution, using the same command-line options that are used in the compilation process, and setintelliSenseMode
togcc-x64
, I get much more sensible IntelliSense output. Since Arduino projects are always compiled using the Arduino AVR-GCC toolchain, and MSVC chokes on GCC-specific macros in official Arduino headers such asSPI.h
, shouldn't this be the default value populated inc_cpp_properties.json
for new projects, rather than MSVC?The
c_cpp_properties.json
that I am using to make Intellisense work in my project (on a Mega2560 board) is as follows. Note that I have also modified the include paths; I can't remember what the reasoning behind them was, except for that I ran into issues with the defaulthardware\arduino\avr\**
andtools\**
paths at some point, and restricting the include paths to specific directories got things working again.The text was updated successfully, but these errors were encountered: