MATLAB and C language mixed programming, including directory settings

Source: Internet
Author: User

If the. c file is not dependent on any third-party libraries, then the MEX compilation is simple and only needs to be entered in the MATLAB command line

Mex test.c can be.

However, if the C file uses third-party library files, such as OpenCV, GSL and so on, then you need to change the MEX compilation options, otherwise it will be reported fetal error C1083, can not find including files.

It is important to note that before the MEX, you need to use the mex-setup to select the compiler, if I choose VS2012, then I need to add the corresponding option to VS2012 the corresponding opt file, the specific location in

' Matlab path \r2013a\bin\win64\mexopts ' below,

VS2012 the corresponding file is Msvc110opts.bat.

After opening this file, locate the set include= and set lib= two lines, add the Inclue path and the LIB path of the library used to each of these two lines.

Once saved, you will need to re-use Mex-setup to select the compiler for the changes to take effect.

There may be a better way to continue exploring the settings that depend on the location of the library.

MATLAB and C language mixed programming, including directory settings

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.