在MATLAB MacMavericks中编译Mex文件

时间:2014-10-15 22:21:40

标签: matlab mex

我一直在尝试按照此链接中的教程:http://thebrainiac1.blogspot.com.es/2012/07/v-behaviorurldefaultvmlo.html

这是一个非常好的教程,但是当我到达第6步并运行compilemex时,编译失败了。我已经精确地遵循了教程,但可能是我使用不同的架构。我正在使用MacOSx Mavericks版本10.9.2。

如果有人在同一台机器上遇到同样的问题并设法解决它,请分享您的想法,因为我需要让它工作。非常感谢!

编译器输出:

K>> compilemex
Compiling mexsvmlearn
Building with 'Xcode with Clang'
/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/mexsvmlearn.c:217:2: warning: '/*' within block comment [-Wcomment]
        /*  strcpy (docfile, argv[i]);

1 warning generated.

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2910:24: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
      if((unlabeled[i] == 2)) {

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2910:24: note: remove extraneous parentheses around the comparison to silence this warning
      if((unlabeled[i] == 2)) {

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2910:24: note: use '=' to turn this equality comparison into an assignment
      if((unlabeled[i] == 2)) {

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2916:29: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
      else if((unlabeled[i] == 3)) {

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2916:29: note: remove extraneous parentheses around the comparison to silence this warning
      else if((unlabeled[i] == 3)) {

/MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/svm_learn.c:2916:29: note: use '=' to turn this equality comparison into an assignment
      else if((unlabeled[i] == 3)) {

2 warnings generated.


MATLAB/HOGFeatureswithSVM/hog_feature_vector/face detection/svm_mex601/src/mexcommon.c:522:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.

compile failed

当我删除try catch int thecompilemex.m时,Matlab输出了这种类型的错误: 使用mex时出错

duplicate symbol _verbosity in:
    /var/folders/j_/1mchj6c53pgdb3bj4rf6324m0000gn/T//mex_3720017078488_810/global.o
    /var/folders/j_/1mchj6c53pgdb3bj4rf6324m0000gn/T//mex_3720017078488_810/svm_hideo.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Error in compilemex (line 7)
    mex -O  -DMATLAB_MEX -I../src ../src/mexsvmlearn.c ../src/global.c ../src/svm_learn.c
    ../src/svm_common.c ../src/svm_hideo.c ../src/mexcommon.c

1 个答案:

答案 0 :(得分:0)

我意识到这个问题很久以前就被问过了,但只是因为你从来没有找到答案而且它一直让你过夜:

这个错误的产生是因为一个变量(在这种情况下,int变量“verbosity”)被多次声明,特别是在'global.c'和'svm_hideo.c'中 - 从任一个删除'int verbosity'其中一个文件和你的mex源代码将顺利编译!

相关问题