SKCONAN

MATLAB - Compile C/C++ to MEX files with MinGW-w64

January 11, 2019

title
  1. Install MinGW-w64 from TDM-GCC MinGW Compiler. (download TDM-GCC)

    • Need to install TDM-GCC MinGW Compiler in a location is not spaces in the path.
    • Recommend: install in C:\TDM-GCC-64.
  2. Open command windows in MATLAB for setup environment.

    2.1 Run command :

    > setenv("MW_MINGW64_LOC", "path")

    e.g. setenv(“MWMINGW64LOC”, “C:\TDM-GCC-64”)

    And

    > mex -setup

    2.2 Click mex -setup C++ (select language that you want to compile)

  3. Now, You can compile c langauage program. Run command :

    > mex filename.c



© 2019, Built with