Skip to main content
antonius
Associate III
June 30, 2019
Question

C++ library with STM32CubeMX ?

  • June 30, 2019
  • 4 replies
  • 985 views

Dear Members,

Is it possible that I combine C language generated from STM32CubeMX with

C++ library ?

Any examples ?

Thanks =)

This topic has been closed for replies.

4 replies

Piranha
Principal III
June 30, 2019

Usually C++ code is put in separate *.cpp/*.hpp files. Add those files to the project and call their functions from C code.

antonius
antoniusAuthor
Associate III
June 30, 2019

I did that, but I can't compile with .cpp after I put --cpp on my compiler, it gave me a lot of errors, I use Keil for compiling.

What should I change to make it compatible between C and C++?

0690X000009YDEAQA4.jpg

Pavel A.
June 30, 2019

> it gave me a lot of errors

Which errors? No need to use --cpp, Keil's compiler will detect c++ file by .cpp extension.,

By the way, which Keil compiler are you using: V5 (armcc) or V6 (clang-like) ?

-- pa

antonius
antoniusAuthor
Associate III
June 30, 2019

I use uVision V5.26.2.0