Struct define in PE

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
542件の閲覧回数
danielchai
Senior Contributor I

Hi,

I used PEs generate a test project. Then I define a structure in ProcessorExpert.c

typedef struct {

    int a;

    int b;

}Test;

 

Then in main, I use " Test test_data;" to define it, but when I compile it, it shows:

"

Test  test_data; 

>expression syntax error

"

Any ideas about this?

 

Thanks.

 

-Daniel

ラベル(1)
0 件の賞賛
1 解決策
447件の閲覧回数
TICS_Fiona
NXP Employee
NXP Employee

According to ANSI rule, the variable defination should be placed at the beginning in the function, and before program code.

元の投稿で解決策を見る

0 件の賞賛
2 返答(返信)
447件の閲覧回数
danielchai
Senior Contributor I

I found some weird things in ProcesssorExpert.c .

When I put the "Test test_data" before calling the function " PE_low_level_init(); ", it compile the project correctly.

But when I put " Test test-data" after calling the function "PE_low_level_init();", it complains the syntax error.

448件の閲覧回数
TICS_Fiona
NXP Employee
NXP Employee

According to ANSI rule, the variable defination should be placed at the beginning in the function, and before program code.

0 件の賞賛