Generate example main
Example C/C++ main file generation
Description
App Configuration Pane: Advanced
Configuration Objects: coder.CodeConfig | coder.EmbeddedCodeConfig
Whether to generate an example C/C++ main function. An example main function is a template to help you to write a C/C++ main function that calls generated C/C++ code.
If you enable example main generation, the code generator produces source and header
files for the main function in the examples subfolder of the build folder.
For C code generation, it generates the files main.c and
main.h. For C++ code generation, it generates the files
main.cpp and main.h.
The example main function declares and initializes data. It calls entry-point functions but does not use values returned from the entry-point functions.
Before using the example main files in your C/C++ application, you must copy the main source and header files to another location and modify them to meet the requirements of the application. See Incorporate Generated Code Using an Example Main Function.
Settings
Generate, but do not compile, an example main functionThis value is the default value.
The code generator generates an example C/C++ main function but does not compile it.
Do not generate an example main functionThe code generator does not generate an example C/C++ main function.
Generate and compile an example main functionThe code generator generates an example C/C++ main function and compiles it to create a test executable. This executable does not return output.
If the
GenCodeOnlyparameter istrue, the code generator does not compile the C/C++ main function.
Programmatic Use
Property:
GenerateExampleMain |
Values: 'GenerateCodeOnly' |
'DoNotGenerate' |
'GenerateCodeAndCompile' |
Default:
'GenerateCodeOnly' |
Version History
Introduced in R2015a