Clear Filters
Clear Filters

C++ code generation: is it possible to put struct declaration in a namespace?

4 views (last 30 days)
Hello,
I am generating C++ code using Embedded Coder in v2021b. I am able to put the generated class in my chosen namespace via the Code Interface dialog:
But in my model i am using various buses, which are translated in C++ structs, which in turn reside in the global namespace.
Is there a way to specify a namespace for these structs too?

Answers (1)

Yoga
Yoga on 10 Sep 2023
I understand that you want to specify a namespace for structs that result out of the various buses you use in the model. This is possible by interactively configuring the C++ resultant code.
I hope this helps resolve your issue.
  1 Comment
fraben
fraben on 13 Sep 2023
Hello Yoga,
Thanks for your answer! I skimmed through the page you linked, but it seems to be only possible to wrap the model's class in a namespace.
I already did that, but from what i understand i can't control the namespace which will contain the structs corresponding to the buses entering/exiting the model: they, indeed, reside in the global namespace.

Sign in to comment.

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!