How can I compile MEX Files without the mex Command?
Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
5 Stimmen
Teilen Sie einen Link zu dieser Frage
Akzeptierte Antwort
7 Stimmen
Teilen Sie einen Link zu dieser Antwort
- c_mexapi_version.c - for C
- cpp_mexapi_version.cpp - for C++
- fortran_mexapi_version.F - for FORTRAN\
- MATLAB_DEFAULT_RELEASE=R2017b - for the large Array Dimensions API
- MATLAB_DEFAULT_RELEASE=R2018a - for the interleaved complex API
- Create a project and insert your MEX source files. In the release R2016b and later add to your MEX sources one version file from the directory matlab\extern\versions. These are the files to choose from:
- On the Project menu, click Properties for the project to open the property pages.
- Under C/C++ General properties, add the MATLAB® include folder, matlab\extern\include, as an additional include folder.
- Under C/C++ Preprocessor properties, add MATLAB_MEX_FILE as a preprocessor definition.
- Add one of the following macros:
- The macro MX_COMPAT_32 for the compatible array dimensions API, or
- The macro MATLAB_DEFAULT_RELEASE=R2017b for the large array dimensions API, or
- The macro MATLAB_DEFAULT_RELEASE=R2018a for interleaved complex API.
- Under Linker General properties, change the output file extension to .mexw64.
- Locate the .lib files for the compiler you are using under matlabroot\extern\lib\win64\microsoft and under Linker Input properties, add libmx.lib, libmex.lib, and libmat.lib as additional dependencies.
- Create a .def file to export the MEX entry point(s). On the Project menu, click Add New Item and select Module-Definition File (.def). Here is the .def file for the releases R2016a and before:
- Under Linker Input properties, add the module definition (.def) file you created.
- Under Linker Debugging properties, if you intend to debug the MEX file using the IDE, specify that the build generates debugging information. For more information about debugging, see Debug on Microsoft Windows Platforms.
- Set the environment variable MWROOT to the MATLAB R2018a installation root directory.
- Copy your MEX sources to the directory mysrc.
- Copy the file $MWROOT/extern/version/c_mexapi_version.c to the directory mysrc.
- Copy the following file Makefile to the directory mysrc.
4 Kommentare
Teilen Sie einen Link zu diesem Kommentar
Teilen Sie einen Link zu diesem Kommentar
Teilen Sie einen Link zu diesem Kommentar

Teilen Sie einen Link zu diesem Kommentar
Weitere Antworten (0)
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!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)
