views:

72

answers:

4
typedef union YYSTYPE {
    int64_t         iConst;         // constant value
    float           fConst;         // constant value
    int             iAttrLocator;   // attribute locator (rowitem for int/float; offset+size for bits)
    int             iFunc;          // function id
    int             iNode;          // node index
} YYSTYPE;

It looks valid to me,but the cdt reports the following for the line int64_t iConst;:

Multiple markers at this line:
    - syntax error before "int64_t"
    - no semicolon at the end of structure or union

There are two files that defines int64_t,one is within the project itself(sphinxstd.h),the other is the project-independent Includes path D:/MinGW/include/stdint.h,is it caused by this conflict?

UPDATE

I select the code above,then by ctrl-x and ctrl-s plus ctrl-v and ctrl-s,the problem is gone!

Is there any cdt users here?

+1  A: 

Did you #include <stdint.h>?

Dean Harding
+1  A: 

You should probably say typedef union YYSTYPE_T to give the union a different name than the typedef.

Justin Ethier
A: 
#include<stdint.h>

typedef union {
   //
} YYSTYPE;

The above typedef is what you probably want. It will declare the new type YYSTYPE

N 1.1
The above code is the asset of an opensource project
Mask
the error with int64_t is that you might have not included stdint.h
N 1.1
It's included,right click on `int64_t` will refer two 2 files,one is `stdint.h`
Mask
@Mask: lets forget that this is an asset of open-source project for a while, and try the above suggestion. I think it should work. If that works, discuss with other project members and correct it.
N 1.1
But the problem is gone by ctrl-x and ctrl-s plus ctrl-v and ctrl-s
Mask
A: 

The compiler doesn't know what to do with int64_t. Since it's not an existing type, it assumes you're trying to declare an identifier. Because the non defined symbol breaks the part of the compiler that parses that line, it complains about the missing semicolon.

Make sure int64_t is defined.

Even if your IDE allows you to right click and go to stdint.h, that does NOT mean that is included. Many IDEs have the standard headers pre-indexed to speed things up.

You might just want to declare it as a long long and be done with it.

Billy ONeal