How can I add a version number to my standalone executable created with MATLAB Compiler?

10 vues (au cours des 30 derniers jours)
I would like to use MATLAB Compiler to generate a Windows standalone executable that has version and file information (which can be seen by right-clicking on the executable and examining its properties, as shown in the screenshot below).

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 30 Sep 2024
Modifié(e) : MathWorks Support Team le 30 Sep 2024

For R2019b and later releases:

On Windows systems, you can now generate standalone applications with system-level version numbers using MATLAB Compiler.
You can specify the version number in the version section of Application Compiler:
Or you can specify a version number using the 'mcc' command:
>> mcc -W 'Main:Appname,version=1.2.3.4'
>> mcc -W 'WinMain:Appname,version=1.2.3.4'
For more information, see the "Tips" section for the 'mcc' command:

For R2019a and earlier releases:

The ability to directly add version and file information into a standalone executable is not available in MATLAB Compiler.
As a workaround, consider compiling a C/C++ shared library, and then wrap it in a driver code to create an executable with versioning info. A C++ demo is included in the attachment.
A walkthrough of how the demo was created is below (file names are specific to the demo):
1. Generate the versionRC.rc file and resource.h file using a supported version of Microsoft Visual Studio. (If you are using Microsoft Visual Studio 2010, you can also use the files already provided and just manually edit the .rc file with a text editor as needed. For newer Visual Studio versions follow the instructions in the word document for creating a new resource file).
Details on its generation is included in the CreateResourceFile.doc word file. resource.h is the header file used by versionRC.rc, needed during the MBUILD command.
2. Compile the shared library using the command:
>> mcc -v -W cpplib:libadd -T link:lib addone.m
3. Write the addprogram.cpp code. (Unfortunately, this code has to interface with the shared library, so it has to be rewritten or updated for different compiled functions.)
4. Compile the final executable using the command:
>> mbuild addprogram.cpp libadd.lib versionRC.rc

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Compiler dans Help Center et File Exchange

Produits


Version

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by