Error: Attempt to read uninitialised memory location.

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

Error: Attempt to read uninitialised memory location.

跳至解决方案
528 次查看
AW60
Contributor I

Hi all,

I am usinh AW60 with codeworrier. I have defined  a gloabal variable in .C file and reading this variable in other .c file. But when i simulate this program with codeworrier i get above error. What is reason for tis error & how can i solve it?

标签 (1)
标记 (1)
0 项奖励
1 解答
382 次查看
bigmac
Specialist III

Hello,

 

As the message says, the debugger is warning that you are attempting to read a memory location that may contain random garbage because it has not yet been initialised.  This suggests that you may have disabled ANSI initialisation of global variables when you created the project.  Your code will then need to explicitly initialise the variable before attempting to read.

 

This only applies to simulation mode.  For the real hardware, the read will return the garbage value.

 

Regards,

Mac

在原帖中查看解决方案

0 项奖励
1 回复
383 次查看
bigmac
Specialist III

Hello,

 

As the message says, the debugger is warning that you are attempting to read a memory location that may contain random garbage because it has not yet been initialised.  This suggests that you may have disabled ANSI initialisation of global variables when you created the project.  Your code will then need to explicitly initialise the variable before attempting to read.

 

This only applies to simulation mode.  For the real hardware, the read will return the garbage value.

 

Regards,

Mac

0 项奖励