【问题标题】:Error in executing compiler script for a custom MATLAB toolbox为自定义 MATLAB 工具箱执行编译器脚本时出错
【发布时间】:2013-10-18 15:55:51
【问题描述】:

我想为我遇到的问题提供分步故障排除。我想使用在http://www.cs.man.ac.uk/~gbrown/fstoolbox/ 找到的工具箱,用于我在 Matlab R2012a 32 位中进行的研究中的各种用途。这是我在使用'CompileFeat.m'脚本时在Matlab中看到的错误,必须调用该脚本来编译用C设计的主要工具箱函数。当然,我将解压缩的文件夹复制到我当前的工作路径中,并将所有文件夹添加到当前工作路径。

>> CompileFEAST

  C:\PROGRA~2\MATLAB\R2012A\BIN\MEX.PL: Error: 'FSToolboxMex.c' not found. 

Error using mex (line 206)
Unable to complete successfully.

Error in CompileFEAST (line 3)
mex -I../MIToolbox FSToolboxMex.c BetaGamma.c CMIM.c CondMI.c DISR.c ICAP.c JMI.c
mRMR_D.c ../MIToolbox/MutualInformation.c ../MIToolbox/Entropy.c
../MIToolbox/CalculateProbability.c ../MIToolbox/Arr 

所以在 Google 上进行了一些挖掘之后,我看到了很多建议,要求我检查是否安装了编译器。请看下面的代码:

>> mex -setup

Welcome to mex -setup.  This utility will help you set up  
a default compiler.  For a list of supported compilers, see  
http://www.mathworks.com/support/compilers/R2012a/win32.html 

Please choose your compiler for building MEX-files: 

Would you like mex to locate installed compilers [y]/n? y

Select a compiler: 
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~2\MATLAB\R2012a\sys\lcc 
[2] Microsoft Software Development Kit (SDK) 7.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0 

[0] None 

Compiler: 2

Please verify your choices: 

Compiler: Microsoft Software Development Kit (SDK) 7.1 
Location: C:\Program Files (x86)\Microsoft Visual Studio 10.0 

Are these correct [y]/n? y

*************************************************************************** 
  Warning: MEX-files generated using Microsoft Windows Software Development  
           Kit (SDK) require that Microsoft Visual Studio 2010 run-time  
           libraries be available on the computer they are run on. 
           If you plan to redistribute your MEX-files to other MATLAB 
           users, be sure that they have the run-time libraries. 
*************************************************************************** 


Trying to update options file: C:\Users\JQ\AppData\Roaming\MathWorks\MATLAB\R2012a\mexopts.bat 
From template:              C:\PROGRA~2\MATLAB\R2012a\bin\win32\mexopts\mssdk71opts.bat 

Done . . . 

************************************************************************** 
  Warning: The MATLAB C and Fortran API has changed to support MATLAB 
           variables with more than 2^32-1 elements.  In the near future 
           you will be required to update your code to utilize the new 
           API. You can find more information about this at: 
           http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html 
           Building with the -largeArrayDims option enables the new API. 

完成这一步后,我会神奇地希望我下次调用“CompileFeast.m”会成功。相反,我收到:

>> CompileFEAST

  C:\PROGRA~2\MATLAB\R2012A\BIN\MEX.PL: Error: 'FSToolboxMex.c' not found. 

Error using mex (line 206)
Unable to complete successfully.

Error in CompileFEAST (line 3)
mex -I../MIToolbox FSToolboxMex.c BetaGamma.c CMIM.c CondMI.c DISR.c ICAP.c JMI.c
mRMR_D.c ../MIToolbox/MutualInformation.c ../MIToolbox/Entropy.c
../MIToolbox/CalculateProbability.c ../MIToolbox/Arr 

又是同样的问题!在进一步调查问题后,建议使用 dir 函数来查看文件是否甚至在目录中(它不是),见下文:

>> dir 'CompileFEAST.m'
CompileFEAST.m not found.

为了确保我可以在我的 Matlab 路径中看到其他文件,我检查了另一个函数以查看它是否在目录中:

>> dir 'hurst.m'

hurst.m

如您所见,此文件位于目录中。我只是提供了与将上述工具箱添加到我的 Matlab 工作路径中相同的过程,我所做的只是将文件复制到工作路径中并将文件或子文件夹添加到路径中。

有人注意到我哪里出错了吗?我不太倾向于解决此类问题,我或多或少使用 Matlab 作为移动模型构建平台来理解算法。

我期待任何 cmets。

干杯, J

【问题讨论】:

  • MATLAB 正在正确找到 CompileFEAST.m。那不是问题。它没有找到 FSToolboxMex.c
  • 感谢您的快速回复@Navan!正如@am304 在下面询问的那样,如何检查 FSToolboxMex.c 所在的目录?如何检查我的当前目录是什么?我为我的基本问题道歉,很多这种术语对我来说是新的......

标签: compiler-errors matlab matlab-compiler


【解决方案1】:

我认为你的当前目录 (pwd) 是错误的。

试试:

cd('E:\School\hidethis\hidethis\MATLAB work\FEAST\FEAST\FSToolbox')
CompileFEAST

【讨论】:

    【解决方案2】:

    即使您可能认为FSToolboxMex.c 在您的 MATLAB 路径中,但似乎并非如此。

    • FSToolboxMex.c 在哪个目录中?
    • 您当前的目录是什么(运行CompileFEAST 的目录)?
    • 您的 MATLAB 路径是什么(使用 path 命令)?
    • which -all FSToolboxMex.c 返回什么?
    • CompileFEAST 的代码是什么样的?

    【讨论】:

    • 1) 如何查看哪个目录? 2)我如何检查我的当前目录? 3) MATLABPATH,然后是列表顶部的 FEAST(工具箱的文件夹名称)的长列表 4) '>> which -all FSToolboxMex.c E:\School\hidethis\hidethis\MATLAB work\FEAST \FEAST\FSToolbox\FSToolboxMex.c' 5) '%将 FEAST 工具箱编译为 mex 可执行文件,用于 MATLAB mex -I../MIToolbox FSToolboxMex.c BetaGamma.c CMIM.c CondMI.c DISR.c ICAP.c JMI.c mRMR_D.c ../MIToolbox/MutualInformation.c ../MIToolbox/Entropy.c ../MIToolbox/CalculateProbability.c ../MIToolbox/ArrayOperations.c'
    【解决方案3】:

    使用“pwd”命令显示我与CompileFEAST.m 不在同一条路径上。这是一个简单的双击并重新运行脚本。这对我来说可能很尴尬,但至少我已经明白了我的错误!感谢大家的快速回复,非常感谢!

    最好, J

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-19
      • 1970-01-01
      • 2014-02-06
      • 1970-01-01
      • 1970-01-01
      • 2015-12-31
      • 2015-03-28
      相关资源
      最近更新 更多