2014-02-28 83 views
0
const EPGState* NewEPGState[] = 
{ 
    &bootupState, 
    &standbyState, 
    &watchtvState, 
    &guideState, 
    &settingsState, 
    &easState, 
    &diagnosticsState 
}; 

此代码有什么问题?我在'*'令牌之前得到错误解析错误 您的答案将不胜感激。编译器的版本,您使用的这些'*'令牌之前的解析错误

+4

可能EPGState不是有效的类型? – michaeltang

+1

显示您在代码中使用的EPGState和其他变量的声明。 – const

+0

你可以摆出整个来源? –

回答

0

检查,此代码编译以及对 G ++ 4.1.2版20071124. 但我假设你已经定义的类/结构EPGState正确和所有在用gcc

编译失败下面使用的变量是相同的类型,即EPGState。

class EPGState 
{ 
}; 
int main() 
{ 
    EPGState bootupState,standbyState; 
    const EPGState* NewEPGState[] = 
    { 
     &bootupState, 
     &standbyState 
    }; 
} 

您是否获得“解析错误”在编译步骤或在运行时。 这个问题并不清楚。

我写了一些示例代码来测试。

#include<iostream> 
int main() 
{ 
    int a; 
    int b; 
    int *ac[]={&a,&b}; 
    return 0; 
} 
  • 以上代码失败上gcc和编译对于g ++。
  • gcc版本4.1.2 20071124(红帽4.1.2-42)

    /tmp/cc6829sJ.o: In function __static_initialization_and_destruction_0(int, int)': test1.cpp:(.text+0x4f): undefined reference to std::ios_base::Init::Init()

+0

我不认为在运行时'''标记之前可能会出现解析错误。除了程序会解析它自己的源代码... – glglgl

+0

@glglgl噢,是的,它不会发生在上面列出的代码中,除了有一些其他的“*”s文件正在被给定的程序解析。 – Singh

+1

'class'? 'iostream'? C? – alk

0

您probaly有

struct EPGState 
{ 
    ... 


struct EPGState bootupState = 
{ 
    ... 

地方。

然后是应

const struct EPGState * NewEPGState[] = 
{ 
    &bootupState, 
    ... 
相关问题