报如下错误:
make -j4 all arm-none-eabi-gcc "../applications/main.c" ../applications/main.c: In function 'bh1750_port': ../applications/main.c:37:5: warning: implicit declaration of function 'rt_hw_bh1750_init' [-Wimplicit-function-declaration] rt_hw_bh1750_init("bh1750", &cfg); ^ linking... ./applications/main.o: In functionbh1750_port':
F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../applications/main.c:32: multiple definition of bh1750_port' ./packages/bh1750-latest/sensor_rohm_bh1750.o:F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../packages/bh1750-latest/sensor_rohm_bh1750.c:143: first defined here ./applications/main.o: In functionmain':
F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../applications/main.c:28: multiple definition of `__rt_init_bh1750_port'
./packages/bh1750-latest/sensor_rohm_bh1750.o:F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../packages/bh1750-latest/sensor_rohm_bh1750.c:21: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:79: rtthread.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.
`#include
define DBG_TAG "main"
define DBG_LVL DBG_LOG
include
include
include
include
include "bh1750.h"
int main(void) { return RT_EOK; } int bh1750_port(void) { struct rt_sensor_config cfg; cfg.intf.dev_name = "i2c2"; //根据传感器所挂的I2C设备修改 cfg.intf.user_data = (void *)BH1750_ADDR; cfg.irq_pin.pin = RT_PIN_NONE; rt_hw_bh1750_init("bh1750", &cfg); rt_hw_bh return 0; } INIT_APP_EXPORT(bh1750_port);`
报如下错误:
make -j4 all arm-none-eabi-gcc "../applications/main.c" ../applications/main.c: In function 'bh1750_port': ../applications/main.c:37:5: warning: implicit declaration of function 'rt_hw_bh1750_init' [-Wimplicit-function-declaration] rt_hw_bh1750_init("bh1750", &cfg); ^ linking... ./applications/main.o: In function
bh1750_port': F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../applications/main.c:32: multiple definition ofbh1750_port' ./packages/bh1750-latest/sensor_rohm_bh1750.o:F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../packages/bh1750-latest/sensor_rohm_bh1750.c:143: first defined here ./applications/main.o: In function
main': F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../applications/main.c:28: multiple definition of `__rt_init_bh1750_port' ./packages/bh1750-latest/sensor_rohm_bh1750.o:F:\STM32\STM32_F411CE_U8G2_sensor\Debug/../packages/bh1750-latest/sensor_rohm_bh1750.c:21: first defined here collect2.exe: error: ld returned 1 exit status make: *** [makefile:79: rtthread.elf] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete.19:04:15 Build Failed. 5 errors, 1 warnings. (took 3s.830ms)`