Problem with jumping from a function to another and back again

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

Problem with jumping from a function to another and back again

ソリューションへジャンプ
3,158件の閲覧回数
admin
Specialist II

Hi. Below are 2 functions:

 

byte self_test(void)
    {   
        ...

        ...

        testing();
    }
 

 

byte testing(void)
    {   
        ...

        ...

        self_test();
    }

 

From the testing function, I'm able to jump to the self_test function since the self_test function is declared above the testing function. However, I'm unable to jump to the testing function if I'm in the self_test function because the testing function is declared below the self_test function. Anyone knows a way to jump between these 2 functions continuously? Thx :smileyhappy:

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,617件の閲覧回数
kef
Specialist I

Do you mean compiler produces warnings or doesn't compile at all because of missing testing() prototype? Then add it above self_test(): 

 

byte testing(void);

 

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
1,618件の閲覧回数
kef
Specialist I

Do you mean compiler produces warnings or doesn't compile at all because of missing testing() prototype? Then add it above self_test(): 

 

byte testing(void);

 

0 件の賞賛
返信
1,617件の閲覧回数
admin
Specialist II

kef wrote:

Do you mean compiler produces warnings or doesn't compile at all because of missing testing() prototype? Then add it above self_test(): 

 

byte testing(void);

 


 

Thx for the reply. The compiler cannot compile at all because it cannot find testing(). And if I put testing() above self_test(), then the compiler will not be able to find self_test(). Therefore I'm only able to jump from one function to the other, but not vice versa.. lol. I've tried inserting "byte testing(void);" above self_test(). But the compiler still cannot compile 
0 件の賞賛
返信
1,617件の閲覧回数
Lundin
Senior Contributor IV
If prototypes doesn't solve it, the problem is related to something else. Post the code.
0 件の賞賛
返信
1,617件の閲覧回数
admin
Specialist II

Lundin wrote:
If prototypes doesn't solve it, the problem is related to something else. Post the code.

Here's the portion I added. I inserted "byte testing(void);" above self_test(), but it still doesn't compile 

 

byte testing(void); 

 

byte self_test(void)
    {   
        ...

        ...

        testing();
    }
 

 

byte testing(void)
    {   
        ...

        ...

        self_test();
    }

0 件の賞賛
返信
1,617件の閲覧回数
stanish
NXP Employee
NXP Employee

Cryptical,

 

What does the complier reports? Can you post here the compiler error message? I guess the problem is somewhere else.


Stanish

 

0 件の賞賛
返信
1,617件の閲覧回数
admin
Specialist II

stanish wrote:

Cryptical,

 

What does the complier reports? Can you post here the compiler error message? I guess the problem is somewhere else.


Stanish

 


 

Hi. I've tested kef's method again. Now it works. I don't know what went wrong before. Lol. Thx for the help guys :smileyhappy:
0 件の賞賛
返信