這是目前網上state of the art 的解決方案:
最開始用的是matlab2017,結果爆了這么一個問題“找不到已安裝的編譯器 'Xcode Clang++'。錯誤使用mex,未找到合適的編譯器”
網上很多方法說的是17和xcode7.0的解決方案,但是都是9012年了啊,誰還用xcode7
在MATLAB的官網上可以看到,R2018b已經支持使用xcode10.+ 進行混合編譯。於是卸載,重裝了matlabR2018b,還是這個問題。
網上也有很多方法,但是還是自己認真讀了讀這個文檔
edit ([matlabroot '/bin/maci64/mexopts/clang_maci64.xml'])
發現主要是程序運行這一步“xcode-select -print-path” 找不到xcode 的appfile
人家都和你說了要
<!-- User needs to run "!sudo xcode-select -switch /Applications/Xcode.app/" to configure xcrun. This creates the file /usr/share/xcode-select/xcode_dir_path -->
所以運行,問題解決
sudo xcode-select -switch /Applications/Xcode.app