posts - 112, comments - 215, trackbacks - 0, articles - 34
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Matlab--mcc命令大全

Posted on 2006-12-12 19:11 济公 阅读(10358) 评论(6)  编辑 收藏 引用 所属分类: VCMatlab
创建动态链接库主要有两种方法: 一种是使用Matlab 为VC++ IDE提供的Add-in。这种方法比较简单,方便快捷,只要在VC++中创建工程的时候选择Matlab Project Wizard,并且在接下来的Step 1 中的Visual Matlab Application Type选择Shared M-DLL 就可以了。接下来就是添加*.m 文件, 进行编译了。另一种方法就是使用Matlab 的mcc 命令将*.m文件编译为动态链接库( *.DLL)。因为Add-in 也是调用Compiler 的命令mcc 进行编译工作的, 而且有时候这个Add-in 还会出现不能使用的情况, 因此这里主要讨论使用mcc 命令的方法。
关于mcc 有很多参数可以使用, 而且有多种用法,主要参数如下:
Bold entries in the Comment/Options column indicate default values
-a filename
 
Add filename to the CTF archive
 

 
-b
 
Generate Excel-compatible formula function
 
Requires MATLAB Builder for Excel
 
-B filename[:arg[,arg]]
 
Replace -B filename on the mcc command line with the contents of filename
 
The file should contain only mcc command line options. These are MathWorks included options files:
-B csharedlib:foo
C shared library
-B cpplib:fooC++ library
 
-c
 
生成C语言包装函数
 
Equivalent to
-T codegen
 
-d directory
 
输出到指定目录
 

 
-f filename
 
Use the specified options file, filename, when calling mbuild
 
mbuild -setup is recommended.
 
-g
 
生成 debugging 信息
 

 
-G
 
同 -g
 

 
-I directory
 
Add directory to search path for M-files
 
MATLAB path is automatically included when running from MATLAB, but not when running from DOS/UNIX shell.
 
-l
 
创建库函数的宏
 
等效于命令
-W lib -T link:lib
 
-m
 
生成C语言独立运行程序的宏
 
等效于命令
-W main -T link:exe
 
-M string
 
传递字符串给 mbuild
 
Use to define compile-time options.
 
-N
 
Clear the path of all but a minimal, required set of directories
 

 
-o outputfile
 
制定最终可执行文件的名字
 
Adds appropriate extension
 
-P directory
 
Add directory to compilation path in an order-sensitive context
 
Requires -N option
 
-R option
 
Specify run-time options for MCR
 
option =
    -nojvm
    -nojit
 
-S
 
Create Singleton MCR
 
Requires MATLAB Builder for COM
 
-T target
 
Specify output stage
 
target = codegen
          compile:
bin
          link:bin
where bin =exe
          lib
 
-v
 
显示详细; 显示编译步骤
 

 
-w option
 
显示警告信息 option = list
    
level
    level:string
where level =disable
    enable
    error
 
-W type
 
Control the generation of function wrappers
 
type =    main  
          cpplib:<string>
          lib:<string>
          
none
    com:compname,clname,version
 
-Y licensefile
 
Use licensefile when checking out a Compiler license
 

 
-z path
 
指定库文件和包含文件的路径
 

 
-?
 
显示帮助信息
 

Feedback

# re: Matlab--mcc命令大全  回复  更多评论   

2006-12-15 18:59 by 我的求职信
我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在我思想所以我存在

# re: Matlab--mcc命令大全  回复  更多评论   

2006-12-15 20:26 by E代青蛙
TO:我的求职信
哪位大侠???

# re: Matlab--mcc命令大全  回复  更多评论   

2008-01-05 09:56 by 小戴
麻烦,请问一下,为什么我的MATLAB不能将M文件转化为C文件?

# re: Matlab--mcc命令大全  回复  更多评论   

2008-12-28 20:48 by df
shibai
只有注册用户登录后才能发表评论。