简体   繁体   中英

Compiling Mex files in MATLAB MacMavericks

I have been trying to follow the tutorial in this link: http://thebrainiac1.blogspot.com.es/2012/07/v-behaviorurldefaultvmlo.html

It is a very good tutorial however, when I arrived to step 6, and ran compilemex, the compile failed. I have followed the tutorial precisely, however it may be the case that I am using a different architecture. I am using MacOSx Mavericks Version 10.9.2.

In case anyone had the same problem on the same machine and managed to solve it please share your idea as I need to make it work. Much appreciated!

Compiler output :

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

When I removed try catch int thecompilemex.m, Matlab outputted this type of error : Error using 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

I realize this question was asked long ago, but just incase you never found an answer and it has been keeping you up an night:

This error is arising because a variable (in this case, the int variable "verbosity") is being declared multiple times, particularly in 'global.c' and 'svm_hideo.c' - go delete 'int verbosity' from either one of those files and your mex sources will compile without a hitch!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM