I want to call MATLAB function in my C++ project.
I\'m using Matlab R2010a and Visual Studio 2010
First I created a simple matlab function:
f
The files foo.h and foo.lib will be required to compile your application. The foo.dll file will need to be shipped with your resulting application, usually in the same directory.
If you put the foo.h file in the same directory as your source files, you won't need to do anything special to #include "foo.h". You can also add the direct path to foo.lib in the external linker dependencies.
If you want to store these files outside of your project folder and/or re-use these files in other applications, you can read up on VC++ Directories, Projects and Solutions.
Edit: You probably also need to add the MATLAB libraries to your include and library paths. Check out the MathWorks support solution Why do I receive the error 'Could not find include file "mclmcrrt.h"' when trying to compile a stand-alone application?