我注意到,MATLAB提供了BLAS和LAPACK标头,其中包括:
$ ls ${MATLAB_DIR}/extern/include/ blas.h engine.h lapack.h mat.h mclmcr.h mex.h mwutil.h blascompat32.h fintrf.h libmatlbm.mlib matrix.h mclmcrrt.h mwdebug.h tmwtypes.h emlrt.h io64.h libmatlbmx.mlib mclcppclass.h mcr.h mwservices.h 我想将它们用于编译后的代码,因此尝试编译以下代码:
ex_blas.c
#include int main() { return 0; } 使用以下命令:
$ mex ex_blas.c 但这返回一个错误:
In file included from ex_blas.c:1: /Applications/MATLAB_R2009b.app/extern/include/blas.h:51: error: syntax error before 鈥?鈥?token /Applications/MATLAB_R2009b.app/extern/include/blas.h:62: error: syntax error before 鈥?鈥?token /Applications/MATLAB_R2009b.app/extern/include/blas.h:77: error: syntax error before 鈥?鈥?token /Applications/MATLAB_R2009b.app/extern/include/blas.h:92: error: syntax error before 鈥?鈥?token /Applications/MATLAB_R2009b.app/extern/include/blas.h:103: error: syntax error before 鈥榩trdiff_t鈥?/Applications/MATLAB_R2009b.app/extern/include/blas.h:122: error: syntax error before 鈥榩trdiff_t鈥? MATLAB提供的blas.h是否可被MATLAB外部的第三方应用程序使用?如果是,是什么导致上述错误?
回答:
我不确定它是否可以完全解决您的问题,但是您可能还必须包含
stddef.h因为这是定义ptrdiff_t类型的地方。
更多&回答...