c++ Project Compile Error about pointer

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

c++ Project Compile Error about pointer

跳至解决方案
1,808 次查看
YS_Kwak
Contributor I

Good day.

I'm trying to solve the compile error regarding pointer, still I couldn't.

See the images.

I just use very simple pointer in order to read MCU register.

YS_Kwak_0-1641340190266.png

But it always shows compile error "invalid conversion from 'uint32_t' {aka ~~~~~~~~"... 

YS_Kwak_1-1641340222233.png

 

Could you please help me to solve this issue?.

Does this compile error come from wrong setting in IDE tool?

 

 

0 项奖励
回复
1 解答
1,794 次查看
ErichStyger
Specialist I

In C++, you cannot assign an integer to a pointer without proper cast.

You have to write something like this:

pRegAddr = (uint32_t*)0x12345678u;

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,795 次查看
ErichStyger
Specialist I

In C++, you cannot assign an integer to a pointer without proper cast.

You have to write something like this:

pRegAddr = (uint32_t*)0x12345678u;

0 项奖励
回复