bmd-studio / stm32-for-vscode

STM32 extension for working with STM32 and CubeMX in VSCode
MIT License
207 stars 27 forks source link

undefined reference to _exit _kill and _getpid #120

Closed JudgeBeeb closed 1 year ago

JudgeBeeb commented 1 year ago

Building a C++ project failed due to undefined references to _exit _kill and _getpid. This happens using code generated by CubeMX without any modifications to the code other than renaming main.c to main.cpp.

Based on what I read here, I changed the linker flags in STM32-for-VSCode.config.yaml by adding -specs=nosys.specs. This solved the problem.

Understanding the nature of this problem is very much above my pay-grade. But hopefully these comments are of assistance.

And thank you very much for an awesome extension.

jortbmd commented 1 year ago

Thank you for sharing the solution! This is indeed the correct way to prevent that kind of error.