Compilation Failures
R2026bYou typically compile your MATLAB® code on a development machine, test the resulting executable on that machine, and deploy the executable and MATLAB Runtime to a test or customer machine without MATLAB. The compilation process performs dependency analysis on your MATLAB code, creates an encrypted archive of your code and required toolbox code, generates wrapper code, and compiles the wrapper code into an executable. If your application fails to build an executable, the following questions may help you isolate the problem.
See the current list of supported compilers at http://www.mathworks.com/support/compilers/current_release/.
mcc can be invoked from the operating system command line or
from the MATLAB prompt. When you run mcc inside the MATLAB environment, MATLAB will modify environment variables in its environment as necessary so
mcc will run. Issues with PATH,
LD_LIBRARY_PATH, or other environment variables seen at the
operating system command line are often not seen at the MATLAB prompt. The environment that MATLAB uses for mcc can be listed at the MATLAB prompt. For example:
>>!set
>>!printenv
mcc
from the operating system command line. The source code for all C/C++ examples is provided with MATLAB
Compiler SDK™ and is located in
,
where matlabroot\extern\examples\compilersdkmatlabroot is the root folder of your MATLAB installation.
If your MATLAB object fails to load, it is typically a result of the MATLAB Runtime not finding required class definitions.
When working with MATLAB objects that are loaded from a MAT file, remember to include the following statement in your MATLAB function:
%#function class_constructor
Using the %#function pragma forces
dependency analyzer to load needed class definitions, enabling the MATLAB Runtime to successfully load the object.
MathWorks® recommends and supports using mbuild to compile
your driver application. mbuild is designed and tested to
correctly build driver applications. It will ensure that all MATLAB header files are found by the C/C++ compiler, and that all necessary
libraries are specified and found by the linker.
If you are using an IDE, in addition to linking to the generated export library,
you need to include an additional dependency to mclmcrrt.lib.
This library is provided for all supported Microsoft® compilers in
.
matlabroot\extern\lib\arch\microsoft
If you have multiple versions of MATLAB installed on your machine, it is possible that an older or
incompatible version of the library is referenced. Ensure that the only MATLAB library that you are linking to is mclmcrrt.lib and
that it is referenced from the appropriate folder.
Try following the example Create C Shared Library with MATLAB Code. Typically, if you cannot compile the examples in the documentation, it indicates an issue with the installation of MATLAB or your system compiler.
The warning message
MATLAB:I18n:InconsistentLocale - The system locale setting, system_locale_name, is different from the user locale setting, user_locale_name
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)