C + + programming with MATLAB, calling Deploytool to generate EXE files and DLL files

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/xlw1219/archive/2012/12/25/2832222.html

You must first know some of the command explanations that you need to know about joint programming:

The role of MCC is to compile. m files into a C/s + + dynamic-link library file, allowing you to use some of the functions of MATLAB in C + + programs. MCC can also compile the. m file as an EXE executable file.

The role of Mex is to compile the C/cpp file into a library file that can be called by the. m file, usually in the Windows operating system, with the extension of mexw32 or mexw64, allowing you to extend MATLAB using C/s + +, which is the ability to invoke C + + writing functions in MATLAB To add new functionality or to speed up the functionality of the original program.

The role of mbuild is to treat Matlab as a C + + compiler, using the mbuild to compile C/s + + as an EXE executable, which is characterized by the ability to invoke the math library and graphics library of MATLAB, but this requires the use of a dynamic connection library provided by Matlab to run.

Note: After I entered the MCC command, there was a problem with Test checkout of feature ' Compiler ' failed, because matlab2014a did not crack and was resolved according to the following link:

http://blog.csdn.net/smilebluesky/article/details/42987985

--------------------------------------Split Line-----------------------Gorgeous turn-------------------------------

When doing MATLAB and C + + mixed programming, you need to set up the system. For example, I want to use Deploytool to generate a C + + dynamic link library (pictured below), you must first run the Mbuild-setup command.

Note that I am using matlab2014a, different from the text, the specific Deploytool compilation process is as follows:

Command line Input deploytool: Select Application Compiler

Then, go to the following page, add the main executed. m file in the Add main file, and then add the auxiliary. m file in the Run application below, then click on the package to generate the EXE file.

After compiling, three folders are generated: Click the exe executable file under the For_testing folder to run.

Behind the work is very simple, a new C + + project, add the generated ImageConvert.exe to the project, write:

#include <windows.h>

int main ()

{

System ("ImageConvert.exe");

}

Run through at once.

C + + with MATLAB programming, call Deploytool generate EXE file and DLL file (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.