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!