I am porting a code which runs perfectly on Linux to windows visual c++. I have this code in Linux:
struct exif_desc
{
uint16_t tag;
uint16_t type;
__attribute__
is a GCC extension, specific to GCC (and other compilers which attempts to be compatible with GCC).
#pragma pack
is originally a Visual C++ compiler specific extension. It has, as noted by commenters, been implemented in GCC as well for VC++ compatibility.
Normally you can't use extensions in one compiler in another compiler. Case in point: __attribute__
doesn't exist as an extension in the Visual C++ compiler.