mex 与 MATLAB2013a 无法识别的开关:-o

2021-12-22 00:00:00 matlab visual-c++ c++ mex

我正在尝试运行一个使用 mex 编译一些 c++ 代码的代码.我已经使用 Microsoft Visual C++ 2010 设置了 mex.但是当我执行该行

I am trying to run a code which compiles some c++ codes using mex. I have set up mex with Microsoft Visual C++ 2010. But when I execute the line

mex -O fconv.cc -o fconv

mex -O fconv.cc -o fconv

我收到错误

compile
    Usage: 
        MEX [option1 ... optionN] sourcefile1 [... sourcefileN] 
            [objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN] 

    Use the -help option for more information, or consult the MATLAB API Guide. 




C:PROGRA~1MATLABR2011ABINMEX.PL: Error: Unrecognized switch: -o. 

我用谷歌搜索了很多,但找不到任何有用的东西.如果有人能在这里帮助我,那就太好了.我对使用 mex 的了解非常有限.

I have googled a lot but couldn't find anything of use. It would be great if you someone could help me out here. I have very limited knowledge of using mex.

推荐答案

来自 mex 的 R2013a 文档(和 当前版本),没有-o选项,但是有-output:

From the R2013a docs for mex (and current version), there is no -o option, but there is -output:

-输出结果名称创建名为 resultname 的二进制 MEX 文件.自动附加适当的 MEX 文件扩展名.覆盖默认的 MEX 文件命名机制.

-output resultname Create binary MEX-file named resultname. Automatically appends the appropriate MEX-file extension. Overrides the default MEX-file naming mechanism.

顺便说一句,除非您使用 -g,否则默认情况下启用大 O 选项 (-O).

BTW, the big O option (-O) is on by default unless you use -g.

请记住,mex 不是编译器,而是编译器的前端.它的语法与您可能用于编译器的语法大不相同.

Keep in mind that mex is not a compiler, but a frontend to the compiler. It has very different syntax from what you might be used to for a compiler.

相关文章