Skip to main content
JDydy.1
Associate
March 24, 2023
Question

Build error

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?

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
March 24, 2023

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
JDydy.1
JDydy.1Author
Associate
March 24, 2023

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

Nawres GHARBI
ST Technical Moderator
March 27, 2023

Hi @Jakub Dydyński​ 

could you attach your output log and project

JDydy.1
JDydy.1Author
Associate
March 27, 2023

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
Principal III
March 29, 2023

> _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.