How can I build an Engine application using Xcode 6 or later?

8 visualizaciones (últimos 30 días)
I would like to run the MATLAB Engine demo 'enginedemo.cpp' in Xcode 6. How can I do that?
The instructions provided here in MATLAB Answers are outdated:

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 17 de Ag. de 2021
Editada: MathWorks Support Team el 9 de Sept. de 2021
  1. Create the project.
    1. Create a command line project, for example “EngineDemo”.  From the menu of Xcode, select File -> New -> Project.  After the new window pops up, choose “Command Line Tool” from Application under OS X category.  In following steps, choose C++ as the Language and fill “EngineDemo” as Product Name.
    2. Delete the automatic generated C++ file.  Right click on the generated file “main.cpp” under folder “EngineDemo” in the Project navigator view and select “Delete”.
    3. Add the Engine example file to the project.  Right click on the folder “EngineDemo” under “EngineDemo” project in Project navigator view, choose “Add Files to EngineDemo” and then select the file “engdemo.cpp” from “<matlabroot>/extern/examples/eng_mat/” folder.  “<matlabroot>” represents where the folder MATLAB is installed, for example, “/Applications/MATLAB_R2015a.app”.
  2.  Configure the Build settings. 
    1. Click on the project “EngineDemo” from the Project navigator view. 
    2. Add linker flags.  Choose Build Settings -> Linking -> Other Linker Flags.  Add “-leng –lmx” to the debug build.
    3. Add header paths.  Choose Build Settings -> Search Paths -> Header Search Paths, add “<matlabroot>/extern/include” to the debug build.
    4. Add library search paths.  Choose Build Settings -> Search Paths -> Library Search Paths, add “<matlabroot>/bin/maci64” to the debug build.
  3. Configure environment variables for debugging.
    1. From the menu of Xcode, select Product -> Scheme -> Edit Scheme. 
    2. After the new window pops up, select Run/Debug from the left panel and choose “Debug” from Build Configuration in the Info panel.
    3. Select Arguments from the right panel and add following environment variables in the Environment Variables section:  DYLD_LIBRARY_PATH with value “<matlabroot>/bin/maci64”, and PATH with value “<matlabroot>/bin:$PATH”.
  4. Build and run the Engine application “EngineDemo”.

Más respuestas (0)

Categorías

Más información sobre Call MATLAB from C en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by