I am using MATLAB R2015b on Mac. I try to run a very simple cpp file using mex in MATLAB, like the following function:
#include "mex.h"#include "stdio.h"#include "iostream"void testFile(){ int i=4; std::cout<<i;}
But the following error occurs:
Building with 'Xcode Clang++'.Error using mexUndefined symbols for architecture x86_64: "_mexFunction", referenced from: -exported_symbol[s_list] command line optionld: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)
However using "make testFile()" in Terminal works well. I studied some solutions in MathWorks but did not work.
Any help would be appreciated.
Thanks,
Best Answer