0

How to compile a MEX file? Do I need to have any software installed?

UmNyobe
  • 22,539
  • 9
  • 61
  • 90
user376089
  • 1,245
  • 3
  • 14
  • 18
  • 3
    MATLAB comes with an excellent documentation and user guides, have you checked them out? http://www.mathworks.com/help/techdoc/matlab_external/f23224.html – Amro Jul 07 '11 at 14:55
  • Have a look here - http://stackoverflow.com/questions/16716821/how-to-build-mex-file-directly-in-visual-studio. – Royi Feb 24 '17 at 10:56

2 Answers2

1

Just compile the file with mex yourmexfile.c.

If you are using 32-bit Windows, you can use LCC which comes with MATLAB. However, the LCC shipped with MATLAB does not contain C++ functionality, so if you are using C++, please refer to MEX-files guide.

siliconwafer
  • 732
  • 4
  • 9
zw324
  • 26,764
  • 16
  • 85
  • 118
0

You can also compile mex files in an IDE. This is not that common when you are starting out but it can be convenient in some cases for more advanced programming. See the following Matlab docs for detailed instructions for Microsoft Visual Studio: http://www.mathworks.com/help/techdoc/matlab_external/f24338.html#f24571

twerdster
  • 4,977
  • 3
  • 40
  • 70
  • The link doesn't work. Do you have updated link? Thank You. – Royi Feb 24 '17 at 09:50
  • I think I found it - https://www.mathworks.com/help/matlab/matlab_external/compiling-mex-files-with-the-microsoft-visual-c-ide.html. The question is, what kind of a project to start? An Executable? A DLL? – Royi Feb 24 '17 at 09:54
  • It seems there is a solution here - http://stackoverflow.com/questions/16716821/how-to-build-mex-file-directly-in-visual-studio. – Royi Feb 24 '17 at 10:56