walnutcy

matlab中安装mcc

0
阅读(2497)

由于要做个小工具分析GPS伪距连续性,考虑用VC+matlab混编,

来个速成吧,呵呵。

步骤如下:

第一步:安装

mbuild -setup
Please choose your compiler for building standalone MATLAB applications:  
Would you like mbuild to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in D:\PROGRA~1\MATLAB\R2009a\sys\lcc
[2] Microsoft Visual C++ 6.0 in D:\Program Files\Microsoft Visual Studio  
[0] None
 
Compiler: 2
 
Please verify your choices:  
Compiler: Microsoft Visual C++ 6.0
Location: D:\Program Files\Microsoft Visual Studio
 
Are these correct [y]/n? y
 
Trying to update options file: C:\Documents and Settings\Administrator\Application Data\MathWorks\MATLAB\R2009a\compopts.bat
From template:              D:\PROGRA~1\MATLAB\R2009a\bin\win32\mbuildopts\msvc60compp.bat
 
Done . . .

第二步:查看MCC命令使用方法: help mcc

第三步:将matlab m文件编译为可执行文件,或 库

    Make a stand-alone C executable for myfun.m:
        mcc -m myfun
   
    Make stand-alone C executable for myfun.m. Look for
     myfun.m in the directory /files/source, and put the resulting C files
     and executable in the directory /files/target:
        mcc -m -I /files/source -d /files/target myfun
   
    Make a stand-alone C executable from myfun1.m and myfun2.m
     (using one mcc call):
        mcc -m myfun1 myfun2
   
    Make a C shared/dynamically linked library called "liba" from a0.m and
    a1.m
        mcc -W lib:liba -T link:lib a0 a1
   
    Make a CPP shared/dynamically linked library called "liba" from a0.m
    and a1.m
        mcc -W cpplib:liba -T link:lib a0 a1

 

第四步:VC中集成调用吧