cancel
Showing results for 
Search instead for 
Did you mean: 

Build error

JDydy.1
Associate II

Hi, i have a STM32Cube project, that builds in stm32cubeide, however when porting it to VSCode extension and trying to build with cmake i get linker error saying: ../arm-none-eabi/lib/crt0.o: in function `_mainCRTStartup': undefined reference to 'main'. Does anyone have any ideas how to solve that?

5 REPLIES 5

If you have main() function in a C++ file, perhaps use extern "C" so it exports

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

That's not the case here, since i am using C

Nawres GHARBI
ST Employee

Hi @Jakub Dydyński​ 

could you attach your output log and project

JDydy.1
Associate II

I attached output. Regarding project it is an example from you site: V53L0A sensor with XNUCLE53L0A. I have ported the project to stm32 cubemx since the project on your site was for SW4STM32 which is old ide i suppose.

Piranha
Chief II

> _mainCRTStartup

https://learn.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol

That function is a C runtime entry-point for Windows console applications. Probably you are building a Windows application instead of ARM firmware.