Struct define in PE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Struct define in PE

Jump to solution
848 Views
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

Labels (1)
0 Kudos
Reply
1 Solution
753 Views
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.

View solution in original post

0 Kudos
Reply
2 Replies
753 Views
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.

754 Views
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 Kudos
Reply