How do I correctly compile MATLAB-generated C/C++ code on macOS High Sierra (10.13.3)?
이전 댓글 표시
Whenever I try to compile MATLAB C/C++ code, whether it be from within MATLAB Coder or outside of it after using MATLAB Coder to generate the source files, I get the following issue:
xcrun clang -c -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "exportMe_initialize.o" "exportMe_initialize.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "exportMe_terminate.o" "exportMe_terminate.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "exportMe.o" "exportMe.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "rt_nonfinite.o" "rt_nonfinite.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "rtGetNaN.o" "rtGetNaN.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64 -fno-common -fexceptions -O0 -DMODEL=exportMe -DHAVESTDIO -DUSE_RTMODEL -DUNIX -I/Users/~/MATLAB-Drive/BacktestWS/codegen/exe/exportMe -I/Users/~/MATLAB-Drive/BacktestWS -I/Applications/MATLAB_R2018a.app/extern/include -I/Applications/MATLAB_R2018a.app/simulink/include -I/Applications/MATLAB_R2018a.app/rtw/c/src -I/Applications/MATLAB_R2018a.app/rtw/c/src/ext_mode/common -I/Applications/MATLAB_R2018a.app/rtw/c/ert -o "rtGetInf.o" "rtGetInf.c"
### Creating standalone executable /Users/~/MATLAB-Drive/BacktestWS/exportMe ...
xcrun clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -Wl,-rpath,/Applications/MATLAB_R2018a.app/bin/maci64 -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path//Users/~/MATLAB-Drive/BacktestWS -L"/Applications/MATLAB_R2018a.app/bin/maci64" -o /Users/~/MATLAB-Drive/BacktestWS/exportMe exportMe_initialize.o exportMe_terminate.o exportMe.o rt_nonfinite.o rtGetNaN.o rtGetInf.o -lm
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [/Users/~/MATLAB-Drive/BacktestWS/exportMe] Error 1
Error(s) encountered while building "exportMe":
### Failed to generate all binary outputs.
This was the result of trying to compile something as simple as:
function exportMe
disp('Hello!')
end
Is there something I'm doing wrong, or something to do with the setup of my system that I can fix? Thank you.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!