Struct define in PE

cancel
Showing results for 
Search instead for 
Did you mean: 

Struct define in PE

Jump to solution
133 Views
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
1 Solution
38 Views
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
2 Replies
38 Views
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.

39 Views
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