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

1 visualizzazione (ultimi 30 giorni)
鑫
il 1 Lug 2025
Commentato: il 11 Ago 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?

Risposte (1)

Kanishk
Kanishk il 11 Lug 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 Commento
鑫
il 11 Ago 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.

Accedi per commentare.

Prodotti


Release

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by