0

我正在尝试在 matlab 中运行一个简单的 mex 示例。.c 程序是

#include <math.h>
#include <matrix.h>
#include <mex.h>

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    printf("Hello World!\n");
}

当我尝试命令“mex helloWorld.c”时,我收到以下错误消息:

/home/rory/com/machine: Command not found.

Warning: You are using gcc version "4.7.2-2)".  The version
     currently supported with MEX is "4.4.x".
     For a list of currently supported compilers see: 
     http://www.mathworks.com/support/compilers/current_release/

我理解第二条错误消息。但我不知道第一个是什么意思。Rory 不是我的名字(我在工作电脑上)。正在寻求什么特定命令,我在哪里可以找到更改为更合适路径的选项?

谢谢,托马斯

[更新] - 按照建议,我已将 printf 替换为 mexPrintf。错误仍然存​​在,但它似乎可以正确编译和运行。运行 -setup 会产生相同的错误,但会像往常一样通知我当前正在使用的选项文件。

目前,看起来我可以忽略该错误。

再次感谢。

4

0 回答 0