compile c++ code using mex
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, I want to compile my c++ code using mex. The error information is as follows. My friend compiled it successfully using his matlab and computer. So I am wondering what my problem is.
In Matlab command window:
>> mex main.cpp -o test Undefined symbols: "_mexFunction", referenced from: -exported_symbol[s_list] command line option ld: symbol(s) not found collect2: ld returned 1 exit status
mex: link of ' "test.mexmaci64"' failed.
Error using mex (line 206) Unable to complete successfully. >>
My computer: Mac OS X 10.6.8
Xcode: Version 3.2.6
Matlab: R2012a
My c++ code:
int main (int argc, char * const argv[]) { // insert code here... std::cout << "Hello, World!\n"; return 0; }
Thanks.
댓글 수: 0
답변 (3개)
Jan
2013년 10월 17일
편집: Jan
2013년 10월 17일
Your code does not have a the required gateway function mexFunction. So you can compile it from the shell or in the IDE of your compiler, but it is not useful and valid for a compiled MEX function.
You can find tutorials for creating and using MEX files e.g. at http://www.mathworks.com/help/matlab/create-mex-files.html.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB Compiler SDK에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!