STM32error: #169: expected a declaration

本文分享了三个常见的编程错误,包括忘记在函数声明后加英文分号,注释符非英文状态输入,以及括号使用时的语言环境问题。这些看似微不足道的错误,实际上可能导致程序无法正常运行。了解并避免这些错误对于提高编程效率至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原因可能有三:
1、声明函数时后面没加英文的;号
2、注释符//不是在英文输入下敲的(这个错误真的很搞笑,但给我遇见了,//给我改成英文的程序就不报错了!!!)
3、()不是在英文状态下输入的

Build started: Project: DUOJI *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin' Build target 'DUOJI' compiling main.c... ../Core/Src/main.c(133): error: #65: expected a ";" { ../Core/Src/main.c(155): warning: #12-D: parsing restarts here after previous syntax error Error_Handler(); ../Core/Src/main.c(70): warning: #177-D: variable "dir" was declared but never referenced uint8_t dir=1; ../Core/Src/main.c(160): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK ../Core/Src/main.c(160): error: #65: expected a ";" RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK ../Core/Src/main.c(162): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; ../Core/Src/main.c(162): error: #65: expected a ";" RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; ../Core/Src/main.c(163): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; ../Core/Src/main.c(163): error: #65: expected a ";" RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; ../Core/Src/main.c(164): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; ../Core/Src/main.c(164): error: #65: expected a ";" RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; ../Core/Src/main.c(165): error: #77-D: this declaration has no storage class or type specifier RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; ../Core/Src/main.c(165): error: #65: expected a ";" RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; ../Core/Src/main.c(167): error: #169: expected a declaration if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) ../Core/Src/main.c(207): warning: At end of source: #12-D: parsing restart
03-26
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值