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

조회 수: 1 (최근 30일)
鑫
2025년 7월 1일
댓글: 2025년 8월 11일
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?

답변 (1개)

Kanishk
Kanishk 2025년 7월 11일
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
鑫
2025년 8월 11일
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.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by