2017-05-05 11:10 AM
Hello,
When I compile STM32CubeMX generated C file with my IDE ( OpenSTM32 last version)
to
C is ever think ok.In the Project Explorer I convert to c++.
But when I change main.c
to main.cpp I get an error message “make: ***http://www.openstm32.org/Drivers/Hans.o
Error 258�?.Is there a solution available?
Thanks JohannesOS windows 10
Version: Mars.2 Release (4.5.2) STM32L432KU STM32Cube V1.0 Version 4.20.#2017-05-08 07:17 AM
Hi,
Please share your .ioc file and
I will report this issue internally for checking.
Thanks
Imen
2017-05-08 11:38 PM
It would be new to me that Cube supports C++.
In the Project Explorer I convert to c++.
But when I change main.c to main.cpp
I get an error message “make: ***
/external-link.jspa?url=http%3A%2F%2Fwww.openstmorg%2FDrivers%2FHans.o
Error 258�?Because it is not that easy.
C++ requires a different startup file, a different linker, and has it's own strategy of naming functions ('name mangling').
Thus your linker trouble.
2017-05-09 05:12 AM
Sorry for my poor description,
I use the openstm32 workbench (IDE).
For my MCU (STM32 L432KU) configuration I use the STMcube (very powerful tool!)
I know that stm32 cube only generate C files, but I use the import function of the IDE.
Convert the file to C++ and rename the main.c to main.cc.
Then the error occurs:
“make: ***
/external-link.jspa?url=http%3A%2F%2Fwww.openstmorg%2FDrivers%2FHans.o
Error 258�?.Is that a problem from stcube or openstm32 workbench, or is it my
fault?
Thanks Johannes
2017-05-09 08:45 AM
Then the error occurs:
“make: ***
/external-link.jspa?url=http%3A%2F%2Fwww.openstmorg%2FDrivers%2FHans.o
Error 258�?.Can you describe/post the actual error message here ?
At least for me, the link does not help. I see no additional information.
AFAIK, openstm32 is Eclipse-based, and thus should give you a full build log.
2017-05-09 10:30 AM
Attached the request files. When I rename under openstm32 the main.cpp back to main.c
the error disappears.
________________ Attachments : global-build.log.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyJP&d=%2Fa%2F0X0000000bAo%2FTC15oP_7FbN13ns0amdPV0z5Wfj.9b2S_.PqaEdd8dI&asPdf=falsetest_st_02.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyZR&d=%2Fa%2F0X0000000bAp%2F9xErxr6.Ktf91hmXYiZR4F2sO7lsivBafjfTkzd.kS4&asPdf=false2017-05-09 12:41 PM
I bet on
https://en.wikipedia.org/wiki/Name_mangling
.C:\Users\Papa\Desktop\workbench_test2\test_st_02\Debug/../startup/startup_stm32l432xx.s:116: undefined reference to `main'
Reading build logs & finding and identifying errors is an essential skill ...
2017-05-09 09:50 PM
Try Atollic. Conversion works a treat there. You'd only have to manually copy all includes and symbols etc over from the C compiler settings. That's easy though as it directly support ctrl+c/v.
2017-05-10 02:31 AM
Adding '
extern 'C'
' to declarations of functions specifically referenced externally would help as well.One should know what he does before assigning the extension of another programming language to a source file.
2017-05-10 03:24 AM
Thanks, I'll try it out.
But I’m surprised, that`s not work a little bit “easier� . To make the base configuration for timer , I2c, etc. with stmcube and work further with Atollic or another IDE in c++ must be the �normal� way….
I think , that will be a good thing ST, Atollic/AC6 work here together and look for a solution…