Unable to Mex C++ Code With Xcode 7.1, OS X 10.10.5, Matlab 2015b
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm having trouble mexing a C++ file on Xcode 7.1 (OS X 10.10.5 and Matlab 2015b). At first, Matlab couldn't find the C++ compiler, so I followed the steps here: http://www.mathworks.com/matlabcentral/answers/246507-why-can-t-mex-find-a-supported-compiler-in-matlab-r2015b-after-i-upgraded-to-xcode-7 . Which seemed to work.
But now when I try to mex my C++ files with this input, I get the below error:
>> mex projection.cpp
Building with 'Xcode Clang++'.
Error using mex
Undefined symbols for architecture x86_64:
"_mexFunction", referenced from:
-exported_symbol[s_list] command line option
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have four .cpp files and six .h files (two files have both a .cpp and .h, the rest don't),compute_pca_update.cpp ptcloud.cpp occ_curve.cpp projection.cpp, matrix2D.h, matrix3D.h, projection.h, ptcloud.h, vector2D.h and vector3D.h . And when I try to mex all four files at once, I get the following error:
>> mex compute_pca_update.cpp ptcloud.cpp occ_curve.cpp projection.cpp
Building with 'Xcode Clang++'.
Error using mex
duplicate symbol _mexFunction in:
/var/folders/b2/qvk6_1mj37z4v1hw7nvftbdc0000gn/T//mex_10738123708000_11432/compute_pca_update.o
/var/folders/b2/qvk6_1mj37z4v1hw7nvftbdc0000gn/T//mex_10738123708000_11432/occ_curve.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This all compiled and ran when I was using Xcode 6, I haven't changed any of the C++ code since then. Can anyone please help with this?
댓글 수: 1
Sriram
2015년 10월 29일
The error says "duplicate symbol _mexFunction", it seems to me that you have two definitions of mexFunction in "compute_pca_update.cpp" and "occ_curve.cpp" . The mex command can take only one definition of mexFunction.
답변 (1개)
Sudhanshu Bhatt
2015년 10월 30일
Hi Jeremy,
The patch mentioned in the external link should be able to detect Xcode 7.1 as the compiler. But as of now Xcode 7.1 is not officially supported with MALTAB R2015b.
Below are some resources that might be helpful:
Hope this helps.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!