以前没有用模块化编程写过程序,现在也是刚刚开始使用模块化编程写程序,我这两天写了一个程序,编译通过了,但链接出了问题,以下是报错的信息:
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Message multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Message multiply defined (by usart_485.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Message multiply defined (by main.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Message multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADC_Value multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADC_Value multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADDR_Flash multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADDR_Flash multiply defined (by usart_485.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADDR_Flash multiply defined (by main.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol ADDR_Flash multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLDRange_Flash multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLDRange_Flash multiply defined (by usart_485.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLDRange_Flash multiply defined (by main.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLDRange_Flash multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Pitch_un multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Pitch_un multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Roll_un multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Roll_un multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLD_un multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLD_un multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Vol_un multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Vol_un multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Temperature_un multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol Temperature_un multiply defined (by stm32f10x_it.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLD_Range multiply defined (by adc_dma.o and sys_config.o).
.\obj\拉力倾斜.axf: Error: L6200E: Symbol VLD_Range multiply defined (by stm32f10x_it.o and sys_config.o).
上面报错信息中Message 变量是一个结构体变量,它放在sys_config.h这个头文件中,在adc_dma.c usart_485.c main.c stm32f10x_it.c这四个源文件中用到了这个结构体变量;
ADC_Value ADDR_Flash VLD_Range 这几个变量也是在sys_config.h这个头文件中定义的;
Pitch_un Roll_un VLD_un Vol_un Temperature_un这几个是联合体变量,也是在sys_config.h这个头文件中定义的, VLD_Range也是定义在sys_config.h头文件中,
在其它的源文件中有用到这些变量的我都包含了sys_config.h这个头文件,但是总说我重定义了,我对模块化编程搞的不是太明白,不知道怎么改。
我好像记得模块化编程的时候定义在头文件中的全局变量在其它文件中是不是只要包含了头文件就可以用了呢?而且在KeilMDK中可以不用加extern,但是不知道为什么,我还是出现了这么多这样的错误 |