After generating MATLAB DLL, how do you implement in C++?
3 views (last 30 days)
Show older comments
I'm trying to run a matlab program within my main c++ code. The below article is where I've been trying to run the example provided in Visual Studio 2015, by running mcc and build commands on the provided files (sierpinski.m, main_for_lib.c, main_for_lib.h, and triangle.c). I created a new project in Visual Studio 2015 and added all the header files to the header folder and all the rest of the files into the source files folder. I'm unable to build and run the program from "triangle.c" file, as the "mclmcrrt.h" file cannot be found. I looked back to my windows folder to see if one was ever generated and that answer is no, there wasn't one generated.
Here are my main questions on this issue:
- by following this example, what is the mclmcrrt.h file and how would I access it?
- how should all my files be added to my c++ project in visual studio, do I need to do some linking/include dependencies?
- What is the main way in c++ to use a matlab dll and call the program in your code?
https://www.mathworks.com/help/compiler_sdk/cxx/matlab-compiler-generated-interface-functions.html
0 Comments
Answers (1)
Varun Gunda
on 3 Apr 2017
If you are using the MCR to utilize the DLLs, please add the directory:
[MCR root]\extern
to your Visual Studio project path. [MCR root] is the MCR installation path on the system. For example: 'C:\Program Files\MATLAB\MATLAB Compiler Runtime\v716\extern'.
If you are using a MATLAB installation to utilize the DLLs, please add the directory:
[matlabroot]\extern
to your Visual Studio project path. [matlabroot] is the MATLAB installation directory on your system. For example: 'C:\Program Files\MATLAB\R2011b\extern'.
You can find [matlabroot] by typing the following command into the command window.
matlabroot
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!