I don't understand this mistake about #pragma

125 views Asked by At

This is the first part of my code and I can't understand the mistake written at the end of the message. Maybe I don't know enough to understand it. I would be very grateful if someone can explain me how #pragma works and what means the mistake. Please!!

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//estructura
#pragma pack(push, 2)
typedef struct {
char telefono[10];
char nombre[26];
char direccion[30];
int cod_cont;
}Agenda;
#pragma pack(pop)
D:/msys64/mingw64/include/vadefs.h:14:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma'
   14 | #pragma pack(push,_CRT_PACKING)
      |         ^~~~

I tried adding this parts:

#pragma pack(push, 2)
#pragma pack(pop)

but the mistake keeps popping up

0

There are 0 answers