开发者

Are there any syntax errors in the code snippet here?

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?


Did you #include <stdint.h>?


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


#include<stdint.h>

typedef union {
   //
} YYSTYPE;

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜