在将.m文件编译为.mexmaci64时遇到构建错误。
我的matlab版本是2011a,使用Xcode 3.2,平台为Mac OS X 10.6。
错误陈述:
??? Build error: Compilation returned error status code 2. See the target build log for further details.
目标构建日志:
3 In file included from mphmm_getEstimation_data.c:13: 4 mphmm_getEstimation_data.h:30: error: expected '=', ',', ';', 'asm' or 'attribute' before 'xb_emlrtRSI' 5 mphmm_getEstimation_data.h:31: error: expected '=', ',', ';', 'asm' or 'attribute' before 'nc_emlrtRSI' 6 mphmm_getEstimation_data.h:32: error: expected '=', ',', ';', 'asm' or 'attribute' before 'oc_emlrtRSI' 7 mphmm_getEstimation_data.h:33: error: expected '=', ',', ';', 'asm' or 'attribute' before 'pc_emlrtRSI' 8 mphmm_getEstimation_data.h:34: error: expected '=', ',', ';', 'asm' or 'attribute' before 'qc_emlrtRSI' 9 mphmm_getEstimation_data.c:22: error: expected '=', ',', ';', 'asm' or 'attribute' before 'xb_emlrtRSI' 10 mphmm_getEstimation_data.c:23: error: expected '=', ',', ';', 'asm' or 'attribute' before 'nc_emlrtRSI' 11 mphmm_getEstimation_data.c:24: error: expected '=', ',', ';', 'asm' or 'attribute' before 'oc_emlrtRSI' 12 mphmm_getEstimation_data.c:25: error: expected '=', ',', ';', 'asm' or 'attribute' before 'pc_emlrtRSI' 13 mphmm_getEstimation_data.c:26: error: expected '=', ',', ';', 'asm' or 'attribute' before 'qc_emlrtRSI' 14 gmake: * [mphmm_getEstimation_data.o]
如果有人可以告诉我如何解决错误,我将不胜感激。如果需要提供代码文件,请告诉我。抱歉,我对此并不专业。
最佳答案
我已经解决了问题。这是一个链接错误,由某些链接参数丢失或某些.h文件丢失引起。结果表明
mwmathutils.h
和
emlrt.h
对于我当前的matlab版本来说,已经过时了。我替换了两个文件,一切开始工作。
关于matlab - Matlab mex中状态码2的构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6405078/