作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 IAR,但收到以下错误:
Error[Pe513]: a value of type "void *" cannot be assigned to an entity of type "void (*)(void)"
下面是生成错误的代码:
uint32_t resethandler_adress = (volatile uint32_t)(FLASH_SECTOR2_BASE_ADRESSE + 4);
void (*app_reset_handler)(void);
app_reset_handler = (void*)resethandler_adress;
最佳答案
正如错误所述,void (*)(void)
与 void*
不同。解决方案是将整数转换为适当的类型。这可以直接完成;目前尚不清楚为什么将其转换为uint32_t
,然后转换为void*
- 或者为什么您可能声明一个文字常量 volatile
。
typedef void (*tResetHandlerFn)(void);
tResetHandlerFn app_reset_handler = (tResetHandlerFn)(FLASH_SECTOR2_BASE_ADDRESS + 4) ;
关于c - IAR 中的错误函数指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55435607/
我无法在附加行中显示“真”、“假”、"is"和“否”按钮。 我在这里有一个应用程序:Application 请按照以下步骤使用应用程序: 1。当你打开应用程序时,你会看到一个绿色的加号按钮,点击 在此
我是一名优秀的程序员,十分优秀!