In the following code snippet (C, for ARM embedded chips)
typedef struct __attribute__((__packed__)) MyStruct_S
{
int MyFirstField;
int MySecondField;
} MyStruct_Type;
VS Code complains on the MyStruct_S identifier, following the attribute. The complaint says "expected a ';'C/C++(65)".
And yet this code compiles and runs just fine even with -Wall and -Wextra compiler flags set.
What is VS Code doing wrong? Can we fix the IntelliSence to see that this is correct syntax?
The extensions I have for this workspace are the following:
cheers!
You should change the C/C++ Extension Configurations. Select a suitable one under the Intellisense Mode
. On Windows, it is by default set to windows-msvc-x64, and on Linux, linux-gcc-x64. Create a new C/C++ configuration (C/C++: Edit Configurations
command), and set the Intellisense Mode to linux-gcc-arm
. Then for your project, using the "C/C++: Select a configuration..."
command change your configuration.