Global variable declaration

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Global variable declaration

ソリューションへジャンプ
1,363件の閲覧回数
shauldorf
Contributor V

I’m new to KDS/KSDK, Where I define global variable that will be seen by main.c , event.c  and maybe in future by other files in the project?

ラベル(1)
1 解決策
1,122件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello shaul dorf:

That is more a C programming question than a question related to KDS or KSDK. If a global variable is to be seen by several source files, you have to define it in one of your .c source files and declare it as extern in a header file. Then include such header file from any source file that needs to "see" the global variable.

If I misunderstood your question please let me know.

Regards!

Jorge Gonzalez

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,122件の閲覧回数
shauldorf
Contributor V

Jorge Thanks;

I already did it and it is working. I’m hardware oriented, I
have seen that PE generates many files so I thought that it can be done automatically
based on information in main.c file

But in second thinking it is a nonsense because only the programmers
knows in which file this extern definition has to be placed.

Any way thanks for your help to finally understand it.

Shaul

1,123件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello shaul dorf:

That is more a C programming question than a question related to KDS or KSDK. If a global variable is to be seen by several source files, you have to define it in one of your .c source files and declare it as extern in a header file. Then include such header file from any source file that needs to "see" the global variable.

If I misunderstood your question please let me know.

Regards!

Jorge Gonzalez

0 件の賞賛
返信