Creating Visual studio project with MATLAB coder generated code

17 ビュー (過去 30 日間)
Kaushik Gowda
Kaushik Gowda 2022 年 3 月 3 日
回答済み: Harsh 2025 年 1 月 23 日 7:11
Hi Mathworks,
I have generated the source code for the my matlab function using the MATLAB coder. I am also using a call to dsp.IFFT() in my code which has created a dspfft.dll dependency in my generated C code. I am trying to establish a visual studio solution to debug and run the generated code with custom main file. I have also used the packNgo function to package all generated code dependencies into zip before adding source in Visual studio. I am getting the following error in visual studio when the source code is trying to load this libray :
Could not open library: dspfft.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.
Error: Could not open library: dspfft.dll.
To run the generated code outside the MATLAB environment, use the packNGo function.
Please let us know what what changes need to made to generated c source code to migrate into visual studio environment or how to setup other dependencies on the side of visual studio.
Note : Both the Matlab coder and DSP system toolbox are the latest version and licences for the same have been purchased.
Thanks and regards,
Kaushik Gowda

回答 (1 件)

Harsh
Harsh 2025 年 1 月 23 日 7:11
Hi Kaushik,
Visual Studio is unable to open the “dspfft.dll” library, which is causing the error you are encountering. To setup external dependencies in Visual Studio please follow the below steps:
  • Highlight your project in the Solution Explorer, and then select Project > Properties.
  • Under Configuration Properties > C/C++ > General, add the folders C:\{Path to your project folder}\codegen\dll\dspfft and matlabroot\extern\include to Additional Include Directories. Separate the entries with a semicolon.
  • Under Configuration Properties > Linker > Input, add dspfft.lib to Additional Dependencies.
  • Under Configuration Properties > Linker > General, add the folder C:\ {Path to your project folder}\ \codegen\dll\dspfft to Additional Library Directories.
You may check the following MATLAB Coder Interface for Visual Studio Code Debugging” from file exchange to debug the code generated by MATLAB coder in Visual Studio Code - https://www.mathworks.com/matlabcentral/fileexchange/103555-matlab-coder-interface-for-visual-studio-code-debugging

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by