2018-02-21 03:47 AM
I've included STM32_USB-FS-Device_Driver in my project. When I compile (in IAR) I get a bunch of errors
Error[Li006]: duplicate definitions for 'Receive_Buffer'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\
MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_init.o' Error[Li006]: duplicate definitions for 'Send_length'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_init.o' Error[Li006]: duplicate definitions for 'Receive_Buffer'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_int.o' Error[Li006]: duplicate definitions for 'Send_length'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_int.o' Error[Li006]: duplicate definitions for 'Receive_Buffer'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_mem.o' Error[Li006]: duplicate definitions for 'Send_length'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_mem.o' Error[Li006]: duplicate definitions for 'Receive_Buffer'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_regs.o' Error[Li006]: duplicate definitions for 'Send_length'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_regs.o' Error[Li006]: duplicate definitions for 'Receive_Buffer'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_sil.o' Error[Li006]: duplicate definitions for 'Send_length'; in 'F:\MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_core.o', and 'F:\ MotorControlSolution\MultiAxisMotorControl\AxisManager\Firmware\STM32F303VC\Debug\Obj\usb_sil.o' Error while running LinkerWhat is wrong?
2018-02-21 03:55 AM
Perhaps a #define is missing, or you're including mutually exclusive things?
Look at the two places the things are supposedly defined, and try to understand the context for their inclusion.
2018-02-21 04:08 AM
What is wrong?
Exactly what it tells you:
Error[Li006]: duplicate definitions for 'Receive_Buffer';
in
'...\usb_core.o',and
'...usb_init.o'
So, as
Turvey.Clive.002
says,Do you, perhaps, have definitions (rather than just declarations) in a header file somewhere ... ?
2018-02-21 04:31 AM
As this is a linker error, perhaps you have a variable defined twice, in two different modules ?
If so, change one into a declaration.
2018-02-21 05:07 AM
It does seem that, in all those messages,
usb_core.o contains one of the duplicated definitions.
That suggests:
either all of the definitions should be in
usb_core.o, and the others should just be accessing them as 'extern';
or none of the definitions should be in
usb_core.o - it should just be accessing them as 'extern' from the other modules.
Again, as you have a working build
from STM32373C-EVAL_FW_V1.0.0, I would start by looking at that to see how it's done.
Then look at your project to see where it's gone wrong.
2018-02-21 05:13 AM
There is no
Receive_Buffer inclusion
- not inusb_core
.c/h not inusb_init
.c/h. Nothing to be 'duplicate'.Besides it's STM USB Library - I didn't write a line of code in it.
I've just opened a demo project (from STM32373C-EVAL_FW_V1.0.0) and it compiles OK - with this library (STM32_USB-FS-Device_Driver).
But in my project the library compiled with errors.
2018-02-21 05:21 AM
There is no
Receive_Buffer inclusion
- not inusb_core
.c/h not inusb_init
.c/h. Nothing to be 'duplicate'.But clearly there is - that is exactly what IAR is telling you in those messages.
Maybe examine the preprocessor output to see exactly what is happening with ♯ includes and conditionals ...
(sorry, I don't use IAR so I don't know the specific options to get the preprocessor output - you will have to check your IAR documentation, or ask IAR).
2018-02-21 05:41 AM
There's no 'perhaps' - that is exactly what the messages are saying!
They even tell you exactly which two modules both contain the definitions.
2018-02-21 05:42 AM
erenburg.evgeny.002 wrote:
I've just opened a demo project (from STM32373C-EVAL_FW_V1.0.0) and it compiles OK - with this library (STM32_USB-FS-Device_Driver).
But in my project the library compiled with errors.
So there is something wrong in your project causing the duplication.
Compare the two projects.
2018-02-21 06:12 AM
There's no 'perhaps' - that is exactly what the messages are saying!
Those error messages refer generically to an object, which could be a function as well - therefore the 'perhaps'.
Only the name 'Receive_Buffer' suggests it is a variable.