Search code examples
c++vxworks

Conflicting Types Error within the same file?


I am building a VxWorks image, and it keeps getting hung up on one particular .cpp file. Here is the error:

C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:144: conflicting types for `typedef struct PMCDATA_STRUCT PMCDATA_STRUCT'
C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:144: previous declaration as `typedef struct PMCDATA_STRUCT PMCDATA_STRUCT'
C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:205: conflicting types for `typedef struct VX_DMA_MEMORY_MAP VX_DMA_MEMORY_MAP'
C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:205: previous declaration as `typedef struct VX_DMA_MEMORY_MAP VX_DMA_MEMORY_MAP'
C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:230: new declaration `struct PMCDATA_STRUCT * GetPmc(int)'
C:\\Tornado2.2\\target\\src\\pmccommon\\pmcvxcommon.h:230: ambiguates old declaration `struct PMCDATA_STRUCT * GetPmc(int)'

I've seen conflicting type errors before, but never when it's comparing to itself! What could this mean?

Here is line 127-144 of pmcvxcommon.h:

typedef struct
{
    >>lines 129-143
}PMCDATA_STRUCT;

PMCDATA_STRUCT is NOT declared elsewhere. This is the same for VX_DMA_MEMORY_MAP.

Any ideas?


Solution

  • Try modifying the pmcvxcommon.h file as follows:

    #ifndef PMCVXCOMMON_H
    #define PMCVXCOMMON_H
    ... original content of file ...
    #endif