0

有人可以解释一下 PC-Lint 错误号吗?38 举个例子...

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.

我不断收到错误,例如...

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

其中是在中声明的access1枚举类型的成员变量。并且该枚举是在不同的头文件中定义的。 包含在.ACCESSClassXACCESSaccess.haccess.hstdafx.h

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

不知道这里有什么问题。哪里不一致?

4

1 回答 1

0

这不是ACCESS问题的定义,而是access1成员在 class 中的位置ClassX。您要么具有类的双重声明,要么(很可能)#pragma pack在编译一个.cpp 时有效,但在编译另一个.cpp 时无效。

于 2016-04-29T11:06:33.370 回答