I have an error of "multiple definition of `ProcessChar'
I have the function ProcessChar() in two source files. There are no header files or prototypes that should make these functions global.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-06 2:12 PM
This is a project created with STM32CubeMX and then coding in the STM32CubeIDE environment.
The error is in the linking process, but wondering why the linker should believe this function is defined twice by default. I had reason to believe these should be local to their own translation units/source files and so the linker treated these are entirely different functions.
I am aware that functions in different source files with the same names is undesirable, but I would prefer to get top the bottom of this rather than simple rename the functions.
Solved! Go to Solution.
- Labels:
-
DEBUG
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-06 2:14 PM
Unless defined as static, body functions will be visible in the global name-space.
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
‎2022-02-06 2:14 PM
Unless defined as static, body functions will be visible in the global name-space.
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
‎2022-02-06 2:20 PM
Many thanks for your quick reply, I thought functions would be local static by default. On some further research I can see this that functions are indeed global.
Many thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-07 12:17 AM
@Community member​ "On some further research I can see this that functions are indeed global"
Indeed: this is standard C - nothing specific to CubeIDE.
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
‎2022-02-07 10:30 PM
> I thought functions would be local static by default.
This is a difference between C and C++.
In C, functions are 'extern' unless declared static.
