How to generate c/c++ code?

3 views (last 30 days)
Jelte on 4 Aug 2014
Commented: Rick Rosson on 14 Aug 2014
Using Matlab R2014a and Matlab coder, I'm trying to generate c or c++ code automatically from Matlab-code. In Coder, I've selected as output type: "C/C++ Dynamic Library", and enabled the option "generate code only". Building does not succeed, resulting in the message "Project ... requires an Embedded Coder license". Do I really need to also buy the toolbox "Embedded Coder"?
Above error message also appears if you try to generate code for the standard Sobel-example"
codegen -config coder.config('lib') sobel

Accepted Answer

Harsha Medikonda
Harsha Medikonda on 5 Aug 2014
  • For Code Generation from MATLAB Code, you would need MATLAB Coder and Embedded Coder.
  • For Code Generation using SIMULINK Models, you would need MATLAB Coder, SIMULINK Coder and Embedded Coder.For information on how you could automatically generate C/C++ code, refer to the following links Matlab Coder Conversion to C
  1 Comment
Rick Rosson
Rick Rosson on 14 Aug 2014
Embedded Coder is not required for either MATLAB Coder or Simulink Coder. It is an optional add-on that provides additional features and capabilities. For certain applications and targets, Embedded Coder is recommended, but not required.

Sign in to comment.

More Answers (1)

Fred Smith
Fred Smith on 14 Aug 2014
You do not need Embedded Coder for any of the activities you mention above. Embedded Coder is an add-on the enriches MATLAB Coder with additional capabilities. It is not needed for the base functionality.
The errors you mention indicate that your system believes Embedded Coder is installed, and is trying to use the license but the license checkout is failing.
You can workaround this by using coder.config(<your usual arguments here>,'ecoder',false). In the App, open the settings dialog and in the All Settings tab disable "Use Embedded Coder Features".
It would be great to understand what is special about your system that is causing this to happen. Are you using the final R2014a image or the prerelease? Did you install Embedded Coder at some time? Anything unusual would be a helpful clue.


Community Treasure Hunt

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

Start Hunting!

Translated by