Matlab Mex编译错误

时间:2016-04-17 10:15:21

标签: matlab matlab-compiler

我正在使用Matlab的随机森林库(link)。我用它来分类。在Windows上它开箱即用(预先组合的mex文件),但我也想在CentOS集群上运行它。

我尝试通过执行{ "exclude": [ "node_modules", "typings" ] } 在群集上编译它,但是我收到了错误。输出如下:

make mex

有人知道如何解决这个问题吗?如果需要,可以从上面的链接中获取RF_MexStandalone-v0.02.zip,然后转到randomforest-matlab / RF_Reg_C / Makefile。

编辑:我已将-o更改为-output,但现在输出如下:

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

我在makefile中找不到选项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 -output mexClassRF_train -lgfortran -lm -DMATLAB -g Building with 'g++'. cc1plus: error: unrecognized command line option "-std=c++11" make: *** [mex_classRF] Error 255

1 个答案:

答案 0 :(得分:0)

错误非常明显:无法识别选项-o。如果您输入mex -help,则会看到mex接受的选项。尝试将-o替换为-output

编辑关于std=c++11选项,您可能正在使用旧版本的gcc编译器。您可以将其更改为std=c++0x这是等效选项(但请注意,c ++ 11标准的某些功能可能不存在\已实现),或升级到{{{}的最新版本1}}。

如果您需要更多帮助,请报告gcc的输出。