Library compile error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 3: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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 3: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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 4: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,- look at the listed files
- find where the definitions are duplicated
- remove the 'spurious' one.
Do you, perhaps, have definitions (rather than just declarations) in a header file somewhere ... ?
http://c-faq.com/decl/decldef.html
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 4: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 5: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.
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 5: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 5: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).
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 5: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.
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 5: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.
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-21 6: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.
