0

Can someone explain me PC-Lint error no. 38 with an example...

38    Offset of symbol 'Symbol' inconsistent (Location)  -- A
      member of a class or struct appears in a different
      position (offset from the start of the structure) than an
      earlier declaration.  This could be caused by array
      dimensions changing from one module to another.

I keep getting errors like...

Offset of symbol 'ClassX::access1' inconsistent (conflicts with line 92, file U:\ABC\ABCApp.h, module U:\ABC\ABCApp.cpp) 

where access1 is a member variable of type enum ACCESS declared in ClassX. And that enum ACCESS is defined in a different header file access.h. access.h is included in stdafx.h.

typedef enum
{
    ACCESS_NONE      = 0,
    ACCESS_READ      = 1
} ACCESS;

Not sure what is problem here. Where is the inconsistency?

user1
  • 4,031
  • 8
  • 37
  • 66

1 Answers1

0

It's not the definition of ACCESS that is the problem, but the position of access1 member in class ClassX. You either have double declaration of the class or (most likely) some rogue #pragma pack that is in effect when compiling one .cpp, but is not in effect when compiling another.

Dialecticus
  • 16,400
  • 7
  • 43
  • 103