Problem with jumping from a function to another and back again

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem with jumping from a function to another and back again

跳至解决方案
3,176 次查看
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,635 次查看
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,636 次查看
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,635 次查看
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,635 次查看
Lundin
Senior Contributor IV
If prototypes doesn't solve it, the problem is related to something else. Post the code.
0 项奖励
回复
1,635 次查看
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,635 次查看
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,635 次查看
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 项奖励
回复