[其他ST产品] STM32库函数 error: #136: struct "<unnamed>" 问题

[复制链接]
2110|6
 楼主| 合同圣诞节fy 发表于 2024-2-29 01:25 | 显示全部楼层 |阅读模式
显示的报错:


../Core/Src/main.c(115): error:  #136: struct "<unnamed>" has no field "HAL_GPIO_WritePin"


WritePin函数的定义:
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
{
  /* Check the parameters */
  assert_param(IS_GPIO_PIN(GPIO_Pin));
  assert_param(IS_GPIO_PIN_ACTION(PinState));

  if (PinState != GPIO_PIN_RESET)
  {
    GPIOx->BSRR = (uint32_t)GPIO_Pin;
  }
  else
  {
    GPIOx->BSRR = (uint32_t)GPIO_Pin << 16;
  }
}



两只袜子 发表于 2024-2-29 11:46 | 显示全部楼层
检查结构体定义
cr315 发表于 2024-2-29 11:51 | 显示全部楼层
检查包含的头文件和库
digit0 发表于 2024-2-29 13:30 | 显示全部楼层
重复定义函数了吧
LinkMe 发表于 2024-2-29 13:30 | 显示全部楼层
是不是没有引入头文件?或者没有开启GPIO
jcky001 发表于 2024-2-29 14:00 | 显示全部楼层
使用结构体是否是已命名的结构体
cr315 发表于 2024-2-29 17:09 | 显示全部楼层
如果你的函数接受一个结构体作为参数,你传递的应该是一个已命名的结构体类型的变量,而不是一个未命名的结构体。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

19

主题

71

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部