MATLAB: Mex compilation error (-o unkown)

mexmex compiler

Hello
I’m using the Random Forest library for Matlab ( link ). I’m using it for classification. On Windows it works very well out of the box (precombiled mex files) but I also want to run it on a CentOS cluster.
I have tried to compile it on the cluster by executing make mex but I’m getting an error. The output is as follows:
rm twonorm_test -rf
rm tempbuild/*.o *.o -rf
rm *~ -rf
rm *.mexw32 twonorm_test -rf
rm *.mexa64 -rf
rm classRF -rf
rm *.exe -rf
echo 'Compiling classTree.cpp'
Compiling classTree.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/classTree.cpp -o tempbuild/classTree.o
echo 'Compiling Cokus (random number generator)'
Compiling Cokus (random number generator)
g++ -fpic -O2 -funroll-loops -msse3 -c src/cokus.cpp -o tempbuild/cokus.o
echo 'Compiling rfsub.f (fortran subroutines)'
Compiling rfsub.f (fortran subroutines)
gfortran -O2 -fpic -c src/rfsub.f -o rfsub.o
echo 'Compiling rfutils.cpp'
Compiling rfutils.cpp
g++ -fpic -O2 -funroll-loops -msse3 -c src/rfutils.cpp -o tempbuild/rfutils.o
echo 'Generating Mex'
Generating Mex
mex src/mex_ClassificationRF_train.cpp src/classRF.cpp tempbuild/classTree.o tempbuild/rfutils.o rfsub.o tempbuild/cokus.o -o mexClassRF_train -lgfortran -lm -DMATLAB -g
Unknown MEX argument '-o'.
make: *** [mex_classRF] Error 255
Does somebody knows how to solve this issue? If you want, you can take RF_MexStandalone-v0.02.zip from the above link and then go to randomforest-matlab/RF_Reg_C/Makefile.

Best Answer

In the corresponding Make file for Windows the mex arguments contain "-output" instead of "-o", so I assume replacing "-o" by "-output" solves the problem.