bmd-studio / stm32-for-vscode

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

Noob Starting #121

Closed aalmeida314 closed 1 year ago

aalmeida314 commented 1 year ago

Hi! I'm a beginner in VSCode and STM32. I would like to clarify some questions.

I use CubeMX to initializer the hardware and create a template for me. However, CubeMX just create .c projects and i would like to program a .cpp project.

I've tried to change the main from .c to .cpp and change the option language in the file STM32-for-VSCode.config.yalm, but it didn't work. (I got this error: MAKE.EXE: *** No rule to make target 'Core/Src/main.c', needed by 'build/main.o'. Stop.)

Is there same way to program in c++ with this extension?

(I'm so sorry if it is a dumb question! I really don't know how to do this. If it was answerd in another post or something similiar, I would love if you could indicate it for me. Thanks in advance!)

jortbmd commented 1 year ago

This is probably due to still having the main.o file. If you do a clean build it should probably be fixed. You can also just delete the build folder to do a clean build. Hope this helps if not please let me know!

aalmeida314 commented 1 year ago

Thank you for the answer.

When I tried to do a clean build, I got these errors:

_(.text.abort+0xa): undefined reference to _exit' (.text._kill_r+0xe): undefined reference to_kill' (.text._getpid_r+0x0): undefined reference to `getpid' collect2.exe: error: ld returned 1 exit status MAKE.EXE: *** [STM32Make.make:205: build/Teste3.elf] Error 1

Even when I tried delete the build folder and did a clean build, I got the same errors. What should I do?

jortbmd commented 1 year ago

Per chance this is an issue that somebody else encountered this week. And described the fix here: https://github.com/bmd-studio/stm32-for-vscode/issues/120 (basically add -specs=nosys.specs to your linkerflags. Also it might be wise to include the stdc++ library in the libraries section of STM32-for-VSCode.config.yaml

aalmeida314 commented 1 year ago

Thank you again. It's done!

jortbmd commented 1 year ago

Good to hear. Good luck with the rest!