C:解决C/OC语言中的编译警告(Warning)&&错误(Error)

本文介绍了几种常见的编译警告及错误,包括'&&'与'||'的混合使用导致的警告、实例变量保护级别错误以及对象发送未识别消息的错误,并提供了具体的解决方法。

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

 

什么是编译警告

当编译程序发现程序代码有异常时,就报一个警告信息(一般会出现黄色感叹号)。警告信息意味着程序中隐含的错误,执行可能会不通过。

注意在编写程序时一定要养成一个好习惯:面对这些警告信息,应尽量去消除它们,以免影响程序的执行。

问题1:warning: '&&' within '||'

例如

警告代码:if(ch>='A'&&ch<='Z'||ch>='a'&&ch<='z'){}

解决方案:更改代码格式为if(((ch>='A')&&(ch<='Z'))||((ch>='a')&&(ch<='z'))){}加上括号即可消除警告。

 

问题2:error: instance variable 'XXXX' is protected

 

例如

错误信息:实例变量‘XXXX’是被保护的

解决方案:在成员变量‘wheels’前加上@public

问题3:error: unrecognized selector sent to instance 0x7ffc68c096f0

 

 

例如

错误信息:给对象发送了一个不能识别的消息

解决方案:方法未定义

 

*** Using Compiler ‘V5.06 update 1 (build 61)’, folder: ‘D:\Keil_v5\ARM\ARMCC\Bin’ Rebuild target ‘ADC-DEMO’ assembling startup_stm32f10x_md.s… compiling main.c… compiling led.c… compiling usart1.c… compiling delay.c… compiling dht11.c… dht11.c(18): warning: #188-D: enumerated type mixed with another type HT11_DQ_OUT(0); //拉??DQ dht11.c(20): warning: #188-D: enumerated type mixed with another type HT11_DQ_OUT(1); //DQ=1 dht11.c: 2 warnings, 0 errors compiling sys.c… compiling stm32f10x_it.c… compiling adc.c… adc.h(41): error: #20: identifier “ADC_HandleTypeDef” is undefined void adc_channel_set(ADC_HandleTypeDef adc_handle, uint32_t ch,uint32_t rank, uint32_t stime); / ADC通??? / adc.c(25): error: #20: identifier “ADC_HandleTypeDef” is undefined ADC_HandleTypeDef g_adc_handle; / ADC?浔? / adc.c(38): error: #20: identifier “ADC_DATAALIGN_RIGHT” is undefined g_adc_handle.Init.DataAlign = ADC_DATAALIGN_RIGHT; / ?荻??敕?式:?叶??? / adc.c(39): error: #20: identifier “ADC_SCAN_DISABLE” is undefined g_adc_handle.Init.ScanConvMode = ADC_SCAN_DISABLE; / ??扫??模式,???玫?一??通?? / adc.c(44): error: #20: identifier “ADC_SOFTWARE_START” is undefined g_adc_handle.Init.ExternalTrigConv = ADC_SOFTWARE_START; / 触发转换方式:?砑シ? / adc.c(45): warning: #223-D: function “HAL_ADC_Init” declared implicitly HAL_ADC_Init(&g_adc_handle); / ??始化 / adc.c(47): warning: #223-D: function “HAL_ADCEx_Calibration_Start” declared implicitly HAL_ADCEx_Calibration_Start(&g_adc_handle); / 校准ADC */ adc.c(56): error: #20: identifier “ADC_HandleTypeDef” is undefined void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) adc.c(61): error: #20: identifier “RCC_PeriphCLKInitTypeDef” is undefined RCC_PeriphCLKInitTypeDef adc_clk_init = {0}; adc.c(63): warning: #223-D: function “__HAL_RCC_ADC1_CLK_ENABLE” declared implicitly DC_ADCX_CHY_CLK_ENABLE(); /* 使??ADCx时?? */ adc.c(64): warning: #223-D: function “__HAL_RCC_GPIOA_CLK_ENABLE” declared implicitly DC_ADCX_CHY_GPIO_CLK_ENABLE(); /* 开??GPIO时?? / adc.c(67): error: #20: identifier “RCC_PERIPHCLK_ADC” is undefined adc_clk_init.PeriphClockSelection = RCC_PERIPHCLK_ADC; / ADC???时?? / adc.c(68): error: #20: identifier “RCC_ADCPCLK2_DIV6” is undefined adc_clk_init.AdcClockSelection = RCC_ADCPCLK2_DIV6; / ??频???6时??为72M/6=12MHz / adc.c(69): warning: #223-D: function “HAL_RCCEx_PeriphCLKConfig” declared implicitly HAL_RCCEx_PeriphCLKConfig(&adc_clk_init); / ???ADC时?? / adc.c(72): error: #136: struct “” has no field “Pin” gpio_init_struct.Pin = ADC_ADCX_CHY_GPIO_PIN; / ADC通??IO?? / adc.c(72): error: #20: identifier “GPIO_PIN_2” is undefined gpio_init_struct.Pin = DC_ADCX_CHY_GPIO_PIN; / ADC通??IO?? / adc.c(73): error: #136: struct “” has no field “Mode” gpio_init_struct.Mode = GPIO_MODE_ANALOG; / 模?? / adc.c(73): error: #20: identifier “GPIO_MODE_ANALOG” is undefined gpio_init_struct.Mode = GPIO_MODE_ANALOG; / 模?? */ adc.c(74): warning: #223-D: function “HAL_GPIO_Init” declared implicitly HAL_GPIO_Init(ADC_ADCX_CHY_GPIO_PORT, &gpio_init_struct); adc.c(94): error: #20: identifier “ADC_HandleTypeDef” is undefined void adc_channel_set(ADC_HandleTypeDef adc_handle, uint32_t ch, uint32_t rank, uint32_t stime) adc.c(96): error: #20: identifier “ADC_ChannelConfTypeDef” is undefined ADC_ChannelConfTypeDef adc_ch_conf; adc.c(101): warning: #223-D: function “HAL_ADC_ConfigChannel” declared implicitly HAL_ADC_ConfigChannel(adc_handle, &adc_ch_conf); / 通??? / adc.c(111): error: #20: identifier “ADC_REGULAR_RANK_1” is undefined adc_channel_set(&g_adc_handle , ch, ADC_REGULAR_RANK_1, ADC_SAMPLETIME_239CYCLES_5); / ???通?溃???泻筒???时?? / adc.c(111): error: #20: identifier “ADC_SAMPLETIME_239CYCLES_5” is undefined adc_channel_set(&g_adc_handle , ch, ADC_REGULAR_RANK_1, ADC_SAMPLETIME_239CYCLES_5); / ???通?溃???泻筒???时?? / adc.c(113): warning: #223-D: function “HAL_ADC_Start” declared implicitly HAL_ADC_Start(&g_adc_handle); / 开??ADC / adc.c(114): warning: #223-D: function “HAL_ADC_PollForConversion” declared implicitly HAL_ADC_PollForConversion(&g_adc_handle, 10); / ??询转换 / adc.c(115): warning: #223-D: function “HAL_ADC_GetValue” declared implicitly return (uint16_t)HAL_ADC_GetValue(&g_adc_handle); / 返???罱?一??ADC1???榈?转换?峁? / adc.c(132): warning: #223-D: function “delay_ms” declared implicitly delay_ms(5); adc.c: 11 warnings, 17 errors compiling atim.c… atim.h(44): error: #20: identifier “TIM_HandleTypeDef” is undefined extern TIM_HandleTypeDef g_timx_cplm_pwm_handle; / 定时??x?浔? / atim.c(26): error: #20: identifier “TIM_HandleTypeDef” is undefined TIM_HandleTypeDef g_timx_cplm_pwm_handle; / 定时??x?浔? */ atim.c(46): error: #20: identifier “TIM_OC_InitTypeDef” is undefined TIM_OC_InitTypeDef tim_oc_cplm_pwm = {0}; atim.c(48): warning: #223-D: function “__HAL_RCC_TIM1_CLK_ENABLE” declared implicitly TIM_TIMX_CPLM_CLK_ENABLE(); /* TIMx 时??使?? */ atim.c(49): warning: #223-D: function “__HAL_RCC_GPIOA_CLK_ENABLE” declared implicitly TIM_TIMX_CPLM_CHY_GPIO_CLK_ENABLE(); /* 通??X??应IO??时??使?? */ atim.c(50): warning: #223-D: function “__HAL_RCC_GPIOB_CLK_ENABLE” declared implicitly TIM_TIMX_CPLM_CHYN_GPIO_CLK_ENABLE(); /* 通??X互补通?蓝?应IO??时??使?? / atim.c(52): error: #136: struct “” has no field “Pin” gpio_init_struct.Pin = ATIM_TIMX_CPLM_CHY_GPIO_PIN; atim.c(52): error: #20: identifier “GPIO_PIN_8” is undefined gpio_init_struct.Pin = TIM_TIMX_CPLM_CHY_GPIO_PIN; atim.c(53): error: #136: struct “” has no field “Mode” gpio_init_struct.Mode = GPIO_MODE_AF_PP; atim.c(53): error: #20: identifier “GPIO_MODE_AF_PP” is undefined gpio_init_struct.Mode = GPIO_MODE_AF_PP; atim.c(54): error: #136: struct “” has no field “Pull” gpio_init_struct.Pull = GPIO_PULLDOWN; atim.c(54): error: #20: identifier “GPIO_PULLDOWN” is undefined gpio_init_struct.Pull = GPIO_PULLDOWN; atim.c(55): error: #136: struct “” has no field “Speed” gpio_init_struct.Speed = GPIO_SPEED_FREQ_HIGH ; atim.c(55): error: #20: identifier “GPIO_SPEED_FREQ_HIGH” is undefined gpio_init_struct.Speed = GPIO_SPEED_FREQ_HIGH ; atim.c(56): warning: #223-D: function “HAL_GPIO_Init” declared implicitly HAL_GPIO_Init(ATIM_TIMX_CPLM_CHY_GPIO_PORT, &gpio_init_struct); atim.c(58): error: #136: struct “” has no field “Pin” gpio_init_struct.Pin = ATIM_TIMX_CPLM_CHYN_GPIO_PIN; atim.c(58): error: #20: identifier “GPIO_PIN_13” is undefined gpio_init_struct.Pin = TIM_TIMX_CPLM_CHYN_GPIO_PIN; atim.c(63): error: #20: identifier “TIM_COUNTERMODE_UP” is undefined g_timx_cplm_pwm_handle.Init.CounterMode = TIM_COUNTERMODE_UP; / ???黾???模式 / atim.c(65): error: #20: identifier “TIM_CLOCKDIVISION_DIV4” is undefined g_timx_cplm_pwm_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; / CKD[1:0] = 10, tDTS = 4 * tCK_INT = Ft / 4 = 18Mhz / atim.c(66): error: #20: identifier “TIM_AUTORELOAD_PRELOAD_ENABLE” is undefined g_timx_cplm_pwm_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; / 使??影?蛹拇???TIMx_ARR / atim.c(67): warning: #223-D: function “HAL_TIM_PWM_Init” declared implicitly HAL_TIM_PWM_Init(&g_timx_cplm_pwm_handle); atim.c(69): error: #20: identifier “TIM_OCMODE_PWM1” is undefined tim_oc_cplm_pwm.OCMode = TIM_OCMODE_PWM1; / PWM模式1 / atim.c(70): error: #20: identifier “TIM_OCPOLARITY_HIGH” is undefined tim_oc_cplm_pwm.OCPolarity = TIM_OCPOLARITY_HIGH; / OCy ?偷?平??效 / atim.c(71): error: #20: identifier “TIM_OCNPOLARITY_HIGH” is undefined tim_oc_cplm_pwm.OCNPolarity = TIM_OCNPOLARITY_HIGH; / OCyN ?偷?平??效 / atim.c(72): error: #20: identifier “TIM_OCIDLESTATE_RESET” is undefined tim_oc_cplm_pwm.OCIdleState = TIM_OCIDLESTATE_RESET; / 当MOE=0,OCx=1 / atim.c(73): error: #20: identifier “TIM_OCNIDLESTATE_RESET” is undefined tim_oc_cplm_pwm.OCNIdleState = TIM_OCNIDLESTATE_RESET; / 当MOE=0,OCxN=1 / atim.c(75): warning: #223-D: function “HAL_TIM_PWM_ConfigChannel” declared implicitly HAL_TIM_PWM_ConfigChannel(&g_timx_cplm_pwm_handle, &tim_oc_cplm_pwm, ATIM_TIMX_CPLM_CHY); atim.c(75): error: #20: identifier “TIM_CHANNEL_1” is undefined HAL_TIM_PWM_ConfigChannel(&g_timx_cplm_pwm_handle, &tim_oc_cplm_pwm, TIM_TIMX_CPLM_CHY); atim.c(77): warning: #223-D: function “HAL_TIM_PWM_Start” declared implicitly HAL_TIM_PWM_Start(&g_timx_cplm_pwm_handle, ATIM_TIMX_CPLM_CHY); / 使??OCy?涑? / atim.c(78): warning: #223-D: function “HAL_TIMEx_PWMN_Start” declared implicitly HAL_TIMEx_PWMN_Start(&g_timx_cplm_pwm_handle, ATIM_TIMX_CPLM_CHY); / 使??OCyN?涑? / atim.c: 8 warnings, 22 errors compiling atk_fan.c… atim.h(44): error: #20: identifier “TIM_HandleTypeDef” is undefined extern TIM_HandleTypeDef g_timx_cplm_pwm_handle; / 定时??x?浔? / atk_fan.c(43): warning: #223-D: function “HAL_TIM_PWM_Stop” declared implicitly HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇???通???涑? / atk_fan.c(43): error: #20: identifier “TIM_CHANNEL_1” is undefined HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇???通???涑? / atk_fan.c(44): warning: #223-D: function “HAL_TIMEx_PWMN_Stop” declared implicitly HAL_TIMEx_PWMN_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇栈ゲ?通???涑? / atk_fan.c(55): warning: #223-D: function “HAL_TIM_PWM_Stop” declared implicitly HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇???通???涑? / atk_fan.c(55): error: #20: identifier “TIM_CHANNEL_1” is undefined HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇???通???涑? / atk_fan.c(56): warning: #223-D: function “HAL_TIMEx_PWMN_Stop” declared implicitly HAL_TIMEx_PWMN_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / ?乇栈ゲ?通???涑? / atk_fan.c(60): warning: #223-D: function “HAL_TIM_PWM_Start” declared implicitly HAL_TIM_PWM_Start(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / 开???通???涑? / atk_fan.c(64): warning: #223-D: function “HAL_TIMEx_PWMN_Start” declared implicitly HAL_TIMEx_PWMN_Start(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); / 开?艋ゲ?通???涑? / atk_fan.c(75): warning: #223-D: function “__HAL_TIM_GetAutoreload” declared implicitly if (para < (__HAL_TIM_GetAutoreload(&g_timx_cplm_pwm_handle))) / ??? */ atk_fan.c(77): warning: #223-D: function “__HAL_TIM_SetCompare” declared implicitly __HAL_TIM_SetCompare(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1, para); atk_fan.c(77): error: #20: identifier “TIM_CHANNEL_1” is undefined __HAL_TIM_SetCompare(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1, para); atk_fan.c: 8 warnings, 4 errors compiling atk_light.c… adc.h(41): error: #20: identifier “ADC_HandleTypeDef” is undefined void adc_channel_set(ADC_HandleTypeDef adc_handle, uint32_t ch,uint32_t rank, uint32_t stime); / ADC通??? */ atk_light.c(33): warning: #223-D: function “__HAL_RCC_GPIOA_CLK_ENABLE” declared implicitly TK_LIGHT_DO_GPIO_CLK_ENABLE(); /* DO时??使?? / atk_light.c(35): error: #136: struct “” has no field “Pin” gpio_init_struct.Pin = ATK_LIGHT_DO_GPIO_PIN; / DO?? / atk_light.c(35): error: #20: identifier “GPIO_PIN_3” is undefined gpio_init_struct.Pin = TK_LIGHT_DO_GPIO_PIN; / DO?? / atk_light.c(36): error: #136: struct “” has no field “Mode” gpio_init_struct.Mode = GPIO_MODE_INPUT; / ??? / atk_light.c(36): error: #20: identifier “GPIO_MODE_INPUT” is undefined gpio_init_struct.Mode = GPIO_MODE_INPUT; / ??? / atk_light.c(37): error: #136: struct “” has no field “Pull” gpio_init_struct.Pull = GPIO_NOPULL; / ???拉 / atk_light.c(37): error: #20: identifier “GPIO_NOPULL” is undefined gpio_init_struct.Pull = GPIO_NOPULL; / ???拉 / atk_light.c(38): warning: #223-D: function “HAL_GPIO_Init” declared implicitly HAL_GPIO_Init(ATK_LIGHT_DO_GPIO_PORT, &gpio_init_struct); / DO?懦?始化 / atk_light.c(51): error: #20: identifier “ADC_CHANNEL_2” is undefined temp_val = adc_get_result_average( DC_ADCX_CHY, 10); / ??取平??值 */ atk_light.c: 2 warnings, 8 errors compiling stm32f10x_gpio.c… compiling stm32f10x_rcc.c… compiling stm32f10x_usart.c… compiling stm32f10x_adc.c… compiling stm32f10x_dma.c… compiling stm32f10x_flash.c… compiling stm32f10x_rtc.c… compiling misc.c… compiling stm32f10x_tim.c… compiling stm32f10x_exti.c… compiling core_cm3.c… compiling system_stm32f10x.c… “.\STM32-DEMO.axf” - 51 Error(s), 31 Warning(s). Target not created. Build Time Elapsed: 00:00:06
最新发布
06-26
*** Using Compiler 'V5.06 update 1 (build 61)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin' Rebuild target 'ADC-DEMO' assembling startup_stm32f10x_md.s... compiling main.c... compiling led.c... compiling usart1.c... compiling delay.c... compiling dht11.c... dht11.c(18): warning: #188-D: enumerated type mixed with another type HT11_DQ_OUT(0); //拉??DQ dht11.c(20): warning: #188-D: enumerated type mixed with another type HT11_DQ_OUT(1); //DQ=1 dht11.c: 2 warnings, 0 errors compiling sys.c... compiling stm32f10x_it.c... compiling adc.c... adc.h(41): error: #20: identifier "ADC_HandleTypeDef" is undefined void adc_channel_set(ADC_HandleTypeDef *adc_handle, uint32_t ch,uint32_t rank, uint32_t stime); /* ADC通?????? */ adc.c(25): error: #20: identifier "ADC_HandleTypeDef" is undefined ADC_HandleTypeDef g_adc_handle; /* ADC?浔? */ adc.c(38): error: #20: identifier "ADC_DATAALIGN_RIGHT" is undefined g_adc_handle.Init.DataAlign = ADC_DATAALIGN_RIGHT; /* ?荻??敕?式:?叶??? */ adc.c(39): error: #20: identifier "ADC_SCAN_DISABLE" is undefined g_adc_handle.Init.ScanConvMode = ADC_SCAN_DISABLE; /* ??扫??模式,???玫?一??通?? */ adc.c(44): error: #20: identifier "ADC_SOFTWARE_START" is undefined g_adc_handle.Init.ExternalTrigConv = ADC_SOFTWARE_START; /* 触发转换方式:?砑シ? */ adc.c(45): warning: #223-D: function "HAL_ADC_Init" declared implicitly HAL_ADC_Init(&g_adc_handle); /* ??始化 */ adc.c(47): warning: #223-D: function "HAL_ADCEx_Calibration_Start" declared implicitly HAL_ADCEx_Calibration_Start(&g_adc_handle); /* 校准ADC */ adc.c(56): error: #20: identifier "ADC_HandleTypeDef" is undefined void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) adc.c(61): error: #20: identifier "RCC_PeriphCLKInitTypeDef" is undefined RCC_PeriphCLKInitTypeDef adc_clk_init = {0}; adc.c(63): warning: #223-D: function "__HAL_RCC_ADC1_CLK_ENABLE" declared implicitly DC_ADCX_CHY_CLK_ENABLE(); /* 使??ADCx时?? */ adc.c(64): warning: #223-D: function "__HAL_RCC_GPIOA_CLK_ENABLE" declared implicitly DC_ADCX_CHY_GPIO_CLK_ENABLE(); /* 开??GPIO时?? */ adc.c(67): error: #20: identifier "RCC_PERIPHCLK_ADC" is undefined adc_clk_init.PeriphClockSelection = RCC_PERIPHCLK_ADC; /* ADC????时?? */ adc.c(68): error: #20: identifier "RCC_ADCPCLK2_DIV6" is undefined adc_clk_init.AdcClockSelection = RCC_ADCPCLK2_DIV6; /* ??频????6时??为72M/6=12MHz */ adc.c(69): warning: #223-D: function "HAL_RCCEx_PeriphCLKConfig" declared implicitly HAL_RCCEx_PeriphCLKConfig(&adc_clk_init); /* ????ADC时?? */ adc.c(72): error: #136: struct "<unnamed>" has no field "Pin" gpio_init_struct.Pin = ADC_ADCX_CHY_GPIO_PIN; /* ADC通??IO?? */ adc.c(72): error: #20: identifier "GPIO_PIN_2" is undefined gpio_init_struct.Pin = DC_ADCX_CHY_GPIO_PIN; /* ADC通??IO?? */ adc.c(73): error: #136: struct "<unnamed>" has no field "Mode" gpio_init_struct.Mode = GPIO_MODE_ANALOG; /* 模?? */ adc.c(73): error: #20: identifier "GPIO_MODE_ANALOG" is undefined gpio_init_struct.Mode = GPIO_MODE_ANALOG; /* 模?? */ adc.c(74): warning: #223-D: function "HAL_GPIO_Init" declared implicitly HAL_GPIO_Init(ADC_ADCX_CHY_GPIO_PORT, &gpio_init_struct); adc.c(94): error: #20: identifier "ADC_HandleTypeDef" is undefined void adc_channel_set(ADC_HandleTypeDef *adc_handle, uint32_t ch, uint32_t rank, uint32_t stime) adc.c(96): error: #20: identifier "ADC_ChannelConfTypeDef" is undefined ADC_ChannelConfTypeDef adc_ch_conf; adc.c(101): warning: #223-D: function "HAL_ADC_ConfigChannel" declared implicitly HAL_ADC_ConfigChannel(adc_handle, &adc_ch_conf); /* 通?????? */ adc.c(111): error: #20: identifier "ADC_REGULAR_RANK_1" is undefined adc_channel_set(&g_adc_handle , ch, ADC_REGULAR_RANK_1, ADC_SAMPLETIME_239CYCLES_5); /* ????通?溃????泻筒???时?? */ adc.c(111): error: #20: identifier "ADC_SAMPLETIME_239CYCLES_5" is undefined adc_channel_set(&g_adc_handle , ch, ADC_REGULAR_RANK_1, ADC_SAMPLETIME_239CYCLES_5); /* ????通?溃????泻筒???时?? */ adc.c(113): warning: #223-D: function "HAL_ADC_Start" declared implicitly HAL_ADC_Start(&g_adc_handle); /* 开??ADC */ adc.c(114): warning: #223-D: function "HAL_ADC_PollForConversion" declared implicitly HAL_ADC_PollForConversion(&g_adc_handle, 10); /* ??询转换 */ adc.c(115): warning: #223-D: function "HAL_ADC_GetValue" declared implicitly return (uint16_t)HAL_ADC_GetValue(&g_adc_handle); /* 返???罱?一??ADC1?????榈?转换?峁? */ adc.c(132): warning: #223-D: function "delay_ms" declared implicitly delay_ms(5); adc.c: 11 warnings, 17 errors compiling atim.c... atim.h(44): error: #20: identifier "TIM_HandleTypeDef" is undefined extern TIM_HandleTypeDef g_timx_cplm_pwm_handle; /* 定时??x?浔? */ atim.c(26): error: #20: identifier "TIM_HandleTypeDef" is undefined TIM_HandleTypeDef g_timx_cplm_pwm_handle; /* 定时??x?浔? */ atim.c(46): error: #20: identifier "TIM_OC_InitTypeDef" is undefined TIM_OC_InitTypeDef tim_oc_cplm_pwm = {0}; atim.c(48): warning: #223-D: function "__HAL_RCC_TIM1_CLK_ENABLE" declared implicitly TIM_TIMX_CPLM_CLK_ENABLE(); /* TIMx 时??使?? */ atim.c(49): warning: #223-D: function "__HAL_RCC_GPIOA_CLK_ENABLE" declared implicitly TIM_TIMX_CPLM_CHY_GPIO_CLK_ENABLE(); /* 通??X??应IO??时??使?? */ atim.c(50): warning: #223-D: function "__HAL_RCC_GPIOB_CLK_ENABLE" declared implicitly TIM_TIMX_CPLM_CHYN_GPIO_CLK_ENABLE(); /* 通??X互补通?蓝?应IO??时??使?? */ atim.c(52): error: #136: struct "<unnamed>" has no field "Pin" gpio_init_struct.Pin = ATIM_TIMX_CPLM_CHY_GPIO_PIN; atim.c(52): error: #20: identifier "GPIO_PIN_8" is undefined gpio_init_struct.Pin = TIM_TIMX_CPLM_CHY_GPIO_PIN; atim.c(53): error: #136: struct "<unnamed>" has no field "Mode" gpio_init_struct.Mode = GPIO_MODE_AF_PP; atim.c(53): error: #20: identifier "GPIO_MODE_AF_PP" is undefined gpio_init_struct.Mode = GPIO_MODE_AF_PP; atim.c(54): error: #136: struct "<unnamed>" has no field "Pull" gpio_init_struct.Pull = GPIO_PULLDOWN; atim.c(54): error: #20: identifier "GPIO_PULLDOWN" is undefined gpio_init_struct.Pull = GPIO_PULLDOWN; atim.c(55): error: #136: struct "<unnamed>" has no field "Speed" gpio_init_struct.Speed = GPIO_SPEED_FREQ_HIGH ; atim.c(55): error: #20: identifier "GPIO_SPEED_FREQ_HIGH" is undefined gpio_init_struct.Speed = GPIO_SPEED_FREQ_HIGH ; atim.c(56): warning: #223-D: function "HAL_GPIO_Init" declared implicitly HAL_GPIO_Init(ATIM_TIMX_CPLM_CHY_GPIO_PORT, &gpio_init_struct); atim.c(58): error: #136: struct "<unnamed>" has no field "Pin" gpio_init_struct.Pin = ATIM_TIMX_CPLM_CHYN_GPIO_PIN; atim.c(58): error: #20: identifier "GPIO_PIN_13" is undefined gpio_init_struct.Pin = TIM_TIMX_CPLM_CHYN_GPIO_PIN; atim.c(63): error: #20: identifier "TIM_COUNTERMODE_UP" is undefined g_timx_cplm_pwm_handle.Init.CounterMode = TIM_COUNTERMODE_UP; /* ???黾???模式 */ atim.c(65): error: #20: identifier "TIM_CLOCKDIVISION_DIV4" is undefined g_timx_cplm_pwm_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; /* CKD[1:0] = 10, tDTS = 4 * tCK_INT = Ft / 4 = 18Mhz */ atim.c(66): error: #20: identifier "TIM_AUTORELOAD_PRELOAD_ENABLE" is undefined g_timx_cplm_pwm_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; /* 使??影?蛹拇???TIMx_ARR */ atim.c(67): warning: #223-D: function "HAL_TIM_PWM_Init" declared implicitly HAL_TIM_PWM_Init(&g_timx_cplm_pwm_handle); atim.c(69): error: #20: identifier "TIM_OCMODE_PWM1" is undefined tim_oc_cplm_pwm.OCMode = TIM_OCMODE_PWM1; /* PWM模式1 */ atim.c(70): error: #20: identifier "TIM_OCPOLARITY_HIGH" is undefined tim_oc_cplm_pwm.OCPolarity = TIM_OCPOLARITY_HIGH; /* OCy ?偷?平??效 */ atim.c(71): error: #20: identifier "TIM_OCNPOLARITY_HIGH" is undefined tim_oc_cplm_pwm.OCNPolarity = TIM_OCNPOLARITY_HIGH; /* OCyN ?偷?平??效 */ atim.c(72): error: #20: identifier "TIM_OCIDLESTATE_RESET" is undefined tim_oc_cplm_pwm.OCIdleState = TIM_OCIDLESTATE_RESET; /* 当MOE=0,OCx=1 */ atim.c(73): error: #20: identifier "TIM_OCNIDLESTATE_RESET" is undefined tim_oc_cplm_pwm.OCNIdleState = TIM_OCNIDLESTATE_RESET; /* 当MOE=0,OCxN=1 */ atim.c(75): warning: #223-D: function "HAL_TIM_PWM_ConfigChannel" declared implicitly HAL_TIM_PWM_ConfigChannel(&g_timx_cplm_pwm_handle, &tim_oc_cplm_pwm, ATIM_TIMX_CPLM_CHY); atim.c(75): error: #20: identifier "TIM_CHANNEL_1" is undefined HAL_TIM_PWM_ConfigChannel(&g_timx_cplm_pwm_handle, &tim_oc_cplm_pwm, TIM_TIMX_CPLM_CHY); atim.c(77): warning: #223-D: function "HAL_TIM_PWM_Start" declared implicitly HAL_TIM_PWM_Start(&g_timx_cplm_pwm_handle, ATIM_TIMX_CPLM_CHY); /* 使??OCy?涑? */ atim.c(78): warning: #223-D: function "HAL_TIMEx_PWMN_Start" declared implicitly HAL_TIMEx_PWMN_Start(&g_timx_cplm_pwm_handle, ATIM_TIMX_CPLM_CHY); /* 使??OCyN?涑? */ atim.c: 8 warnings, 22 errors compiling atk_fan.c... atim.h(44): error: #20: identifier "TIM_HandleTypeDef" is undefined extern TIM_HandleTypeDef g_timx_cplm_pwm_handle; /* 定时??x?浔? */ atk_fan.c(43): warning: #223-D: function "HAL_TIM_PWM_Stop" declared implicitly HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇???通???涑? */ atk_fan.c(43): error: #20: identifier "TIM_CHANNEL_1" is undefined HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇???通???涑? */ atk_fan.c(44): warning: #223-D: function "HAL_TIMEx_PWMN_Stop" declared implicitly HAL_TIMEx_PWMN_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇栈ゲ?通???涑? */ atk_fan.c(55): warning: #223-D: function "HAL_TIM_PWM_Stop" declared implicitly HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇???通???涑? */ atk_fan.c(55): error: #20: identifier "TIM_CHANNEL_1" is undefined HAL_TIM_PWM_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇???通???涑? */ atk_fan.c(56): warning: #223-D: function "HAL_TIMEx_PWMN_Stop" declared implicitly HAL_TIMEx_PWMN_Stop(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* ?乇栈ゲ?通???涑? */ atk_fan.c(60): warning: #223-D: function "HAL_TIM_PWM_Start" declared implicitly HAL_TIM_PWM_Start(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* 开????通???涑? */ atk_fan.c(64): warning: #223-D: function "HAL_TIMEx_PWMN_Start" declared implicitly HAL_TIMEx_PWMN_Start(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1); /* 开?艋ゲ?通???涑? */ atk_fan.c(75): warning: #223-D: function "__HAL_TIM_GetAutoreload" declared implicitly if (para < (__HAL_TIM_GetAutoreload(&g_timx_cplm_pwm_handle))) /* ???? */ atk_fan.c(77): warning: #223-D: function "__HAL_TIM_SetCompare" declared implicitly __HAL_TIM_SetCompare(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1, para); atk_fan.c(77): error: #20: identifier "TIM_CHANNEL_1" is undefined __HAL_TIM_SetCompare(&g_timx_cplm_pwm_handle, TIM_CHANNEL_1, para); atk_fan.c: 8 warnings, 4 errors compiling atk_light.c... adc.h(41): error: #20: identifier "ADC_HandleTypeDef" is undefined void adc_channel_set(ADC_HandleTypeDef *adc_handle, uint32_t ch,uint32_t rank, uint32_t stime); /* ADC通?????? */ atk_light.c(33): warning: #223-D: function "__HAL_RCC_GPIOA_CLK_ENABLE" declared implicitly TK_LIGHT_DO_GPIO_CLK_ENABLE(); /* DO时??使?? */ atk_light.c(35): error: #136: struct "<unnamed>" has no field "Pin" gpio_init_struct.Pin = ATK_LIGHT_DO_GPIO_PIN; /* DO?? */ atk_light.c(35): error: #20: identifier "GPIO_PIN_3" is undefined gpio_init_struct.Pin = TK_LIGHT_DO_GPIO_PIN; /* DO?? */ atk_light.c(36): error: #136: struct "<unnamed>" has no field "Mode" gpio_init_struct.Mode = GPIO_MODE_INPUT; /* ???? */ atk_light.c(36): error: #20: identifier "GPIO_MODE_INPUT" is undefined gpio_init_struct.Mode = GPIO_MODE_INPUT; /* ???? */ atk_light.c(37): error: #136: struct "<unnamed>" has no field "Pull" gpio_init_struct.Pull = GPIO_NOPULL; /* ??????拉 */ atk_light.c(37): error: #20: identifier "GPIO_NOPULL" is undefined gpio_init_struct.Pull = GPIO_NOPULL; /* ??????拉 */ atk_light.c(38): warning: #223-D: function "HAL_GPIO_Init" declared implicitly HAL_GPIO_Init(ATK_LIGHT_DO_GPIO_PORT, &gpio_init_struct); /* DO?懦?始化 */ atk_light.c(51): error: #20: identifier "ADC_CHANNEL_2" is undefined temp_val = adc_get_result_average( DC_ADCX_CHY, 10); /* ??取平??值 */ atk_light.c: 2 warnings, 8 errors compiling stm32f10x_gpio.c... compiling stm32f10x_rcc.c... compiling stm32f10x_usart.c... compiling stm32f10x_adc.c... compiling stm32f10x_dma.c... compiling stm32f10x_flash.c... compiling stm32f10x_rtc.c... compiling misc.c... compiling stm32f10x_tim.c... compiling stm32f10x_exti.c... compiling core_cm3.c... compiling system_stm32f10x.c... ".\STM32-DEMO.axf" - 51 Error(s), 31 Warning(s). Target not created. Build Time Elapsed: 00:00:06
06-26
[root@VM-24-11-opencloudos nginx-1.24.0]# ./configure --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --with-openssl=/www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --add-module=/www/server/nginx/src/ngx_http_substitutions_filter_module-master --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-http_dav_module --add-module=/www/server/nginx/src/nginx-dav-ext-module --add-module=/usr/local/fastdfs-nginx-module/src checking for OS + Linux 6.6.47-12.oc9.x86_64 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 12.3.1 20230912 (OpenCloudOS 12.3.1.3-1) (Tencent Compiler 12.3.1.3) checking for gcc -pipe switch ... found checking for --with-ld-opt="-Wl,-E" ... found checking for -Wl,-E switch ... found checking for gcc builtin atomic operations ... found checking for C99 variadic macros ... found checking for gcc variadic macros ... found checking for gcc builtin 64 bit byteswap ... found checking for unistd.h ... found checking for inttypes.h ... found checking for limits.h ... found checking for sys/filio.h ... not found checking for sys/param.h ... found checking for sys/mount.h ... found checking for sys/statvfs.h ... found checking for crypt.h ... found checking for Linux specific features checking for epoll ... found checking for EPOLLRDHUP ... found checking for EPOLLEXCLUSIVE ... found checking for eventfd() ... found checking for O_PATH ... found checking for sendfile() ... found checking for sendfile64() ... found checking for sys/prctl.h ... found checking for prctl(PR_SET_DUMPABLE) ... found checking for prctl(PR_SET_KEEPCAPS) ... found checking for capabilities ... found checking for crypt_r() ... found checking for sys/vfs.h ... found checking for UDP_SEGMENT ... found checking for nobody group ... found checking for poll() ... found checking for /dev/poll ... not found checking for kqueue ... not found checking for crypt() ... not found checking for crypt() in libcrypt ... found checking for F_READAHEAD ... not found checking for posix_fadvise() ... found checking for O_DIRECT ... found checking for F_NOCACHE ... not found checking for directio() ... not found checking for statfs() ... found checking for statvfs() ... found checking for dlopen() ... found checking for sched_yield() ... found checking for sched_setaffinity() ... found checking for SO_SETFIB ... not found checking for SO_REUSEPORT ... found checking for SO_ACCEPTFILTER ... not found checking for SO_BINDANY ... not found checking for IP_TRANSPARENT ... found checking for IP_BINDANY ... not found checking for IP_BIND_ADDRESS_NO_PORT ... found checking for IP_RECVDSTADDR ... not found checking for IP_SENDSRCADDR ... not found checking for IP_PKTINFO ... found checking for IPV6_RECVPKTINFO ... found checking for TCP_DEFER_ACCEPT ... found checking for TCP_KEEPIDLE ... found checking for TCP_FASTOPEN ... found checking for TCP_INFO ... found checking for accept4() ... found checking for int size ... 4 bytes checking for long size ... 8 bytes checking for long long size ... 8 bytes checking for void * size ... 8 bytes checking for uint32_t ... found checking for uint64_t ... found checking for sig_atomic_t ... found checking for sig_atomic_t size ... 4 bytes checking for socklen_t ... found checking for in_addr_t ... found checking for in_port_t ... found checking for rlim_t ... found checking for uintptr_t ... uintptr_t found checking for system byte ordering ... little endian checking for size_t size ... 8 bytes checking for off_t size ... 8 bytes checking for time_t size ... 8 bytes checking for AF_INET6 ... found checking for setproctitle() ... not found checking for pread() ... found checking for pwrite() ... found checking for pwritev() ... found checking for strerrordesc_np() ... found checking for localtime_r() ... found checking for clock_gettime(CLOCK_MONOTONIC) ... found checking for posix_memalign() ... found checking for memalign() ... found checking for mmap(MAP_ANON|MAP_SHARED) ... found checking for mmap("/dev/zero", MAP_SHARED) ... found checking for System V shared memory ... found checking for POSIX semaphores ... found checking for struct msghdr.msg_control ... found checking for ioctl(FIONBIO) ... found checking for ioctl(FIONREAD) ... found checking for struct tm.tm_gmtoff ... found checking for struct dirent.d_namlen ... not found checking for struct dirent.d_type ... found checking for sysconf(_SC_NPROCESSORS_ONLN) ... found checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found checking for openat(), fstatat() ... found checking for getaddrinfo() ... found configuring additional modules adding module in /www/server/nginx/src/ngx_devel_kit + ngx_devel_kit was configured adding module in /www/server/nginx/src/lua_nginx_module checking for LuaJIT library in /usr/local/lib and /usr/local/include/luajit-2.1 (specified by the LUAJIT_LIB and LUAJIT_INC env, with -ldl) ... found checking for LuaJIT 2.x ... found checking for Lua language 5.1 ... found checking for LuaJIT has FFI ... found checking for export symbols by default (-E) ... found checking for export symbols by default (--export-all-symbols) ... not found checking for SO_PASSCRED ... found checking for SA_RESTART ... found checking for malloc_trim ... found checking for pipe2 ... found checking for signalfd ... found checking for execvpe ... found + ngx_http_lua_module was configured adding module in /www/server/nginx/src/ngx_cache_purge + ngx_http_cache_purge_module was configured adding module in /www/server/nginx/src/ngx_http_substitutions_filter_module-master + ngx_http_subs_filter_module was configured adding module in /www/server/nginx/src/nginx-dav-ext-module + ngx_http_dav_ext_module was configured adding module in /usr/local/fastdfs-nginx-module/src + ngx_http_fastdfs_module was configured checking for zlib library ... found checking for libxslt ... found checking for libexslt ... found checking for GD library ... found checking for GD WebP support ... found creating objs/Makefile Configuration summary + using PCRE library: pcre-8.43 + using OpenSSL library: /www/server/nginx/src/openssl + using system zlib library nginx path prefix: "/www/server/nginx" nginx binary file: "/www/server/nginx/sbin/nginx" nginx modules path: "/www/server/nginx/modules" nginx configuration prefix: "/www/server/nginx/conf" nginx configuration file: "/www/server/nginx/conf/nginx.conf" nginx pid file: "/www/server/nginx/logs/nginx.pid" nginx error log file: "/www/server/nginx/logs/error.log" nginx http access log file: "/www/server/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp" ./configure: warning: the "--with-ipv6" option is deprecated [root@VM-24-11-opencloudos nginx-1.24.0]# ^C [root@VM-24-11-opencloudos nginx-1.24.0]# make make -f objs/Makefile make[1]: Entering directory '/www/server/nginx/src/nginx-1.24.0' cd pcre-8.43 \ && if [ -f Makefile ]; then make distclean; fi \ && CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \ ./configure --disable-shared /bin/sh: line 1: cd: pcre-8.43: No such file or directory make[1]: *** [objs/Makefile:2256: pcre-8.43/Makefile] Error 1 make[1]: Leaving directory '/www/server/nginx/src/nginx-1.24.0' make: *** [Makefile:10: build] Error 2
06-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

两块三刀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值