After generating MATLAB DLL, how do you implement in C++?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Varun Gunda
2017년 4월 3일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Software Development Tools에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!