I want to edit the smt32 code in Visual Studio 17. Evry paths I configured and all needed defined were added, but I still have one problem:
I have number of structures that looks in this way:
typedef struct __attribute__((packed)) __struct_name
{
uint16_t id;
uint8_t code;
} STRUCT_NAME;
The Visual Studio editor highlights the __struct_name
and shows error tooltip with the next error:
expected a ';'
Of course, in Keil everything is ok.
Please, your help with the error - what I'm doing wrong?
:::UPDATE:::
Thanks to @vlk for the answer!
Visual Studio code should be packed in the different way.
To check the packed vs. non-packed structures, please, run the next code:
#include <stdio.h>
#include <stdint.h>
typedef struct __tt__
{
uint16_t u16;
uint8_t u8;
} TT;
typedef struct __attribute__((packed)) __pp__
{
uint16_t u16;
uint8_t u8;
} PP;
int main()
{
TT tt;
PP pp;
printf("TT size: %d\n", sizeof(tt));
printf("\nPP size: %d\n", sizeof(pp));
return 0;
}