What libraries are generated c/c++ code needed?

1 view (last 30 days)
鑫
on 1 Jul 2025
Commented: on 11 Aug 2025
I'm using coder to generated c/c++ code on windows and compile it to a shared library on linux. How can I now what libraries are needed to link? Sometimes math lib is required, while sometimes not. Are there some methods to automaticly compile generated regardless what libraries are needed?

Answers (1)

Kanishk
Kanishk on 11 Jul 2025
Hello,
I understand you are generating C/C++ code on windows and want to compile the generated code on a linux machine.
In the Model's configuration parameters, set the 'Device Vendor' to be either 'AMD' or 'Intel' and 'Device Type' to be 'x86-64 (Linux 64)' and enable the 'Package code and artifacts' and 'Generate Code only' in the Code generation options. This will generate a zip folder with all the required files to build the executable which can be used in the linux development environment.
You can follow this article from MathWorks support to learn more.
Hope this helps!
  1 Comment
鑫
on 11 Aug 2025
Thanks for your anwser!
Sometimes, "-lm" is needed to be added to the compile command. I wonder if there are other libs that might be needed.

Sign in to comment.

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!