1 执行命令:>> deploytool

android 可执行文件获取系统服务 app可执行文件_MATLAB

选择【Application Compiler】

android 可执行文件获取系统服务 app可执行文件_matlab_02

 【选择加号,添加你的应用源码】

 

android 可执行文件获取系统服务 app可执行文件_开发语言_03

 【点击,Package】进行打包

 

android 可执行文件获取系统服务 app可执行文件_开发语言_04

然后,生成了如下的目录结构:


2 mbuild

【设定编译器,由于我的系统右VS2019所以,他会自动弹出来,让我进行配置】

>> mbuild -setup
MBUILD 配置为使用 'Microsoft Visual C++ 2019 (C)' 以进行 C 语言编译。

要选择不同的语言,请从以下选项中选择一种命令:
 mex -setup C++ -client MBUILD 
 mex -setup FORTRAN -client MBUILD

3 mcc

mcc Command Arguments Listed Alphabetically

Option    Description    Comment
-a path
Add path to the deployable archive.
If a folder name is specified, all files in the folder are added. If a wildcard is used all files matching the wildcard are added.
-b    
Generate Excel® compatible formula function.
Requires MATLAB® Compiler™ for Excel add-ins
-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:foo (C++ library)
-c    
Generate C wrapper code.
Equivalent to -T codegen
-C    
Direct mcc to not embed the deployable archive in generated binaries.
 
-d directory    
Place output in specified folder.
 
-e    
Suppresses appearance of the MS-DOS Command Window when generating a standalone application.
Use -e in place of the -m option. Available for Windows® only. Use with -R option to generate error logging. Equivalent to -W WinMain -T link:exe
The standalone app compiler suppresses the MS-DOS command window by default. To unsuppress it, unselect Do not require Windows Command Shell (console) for execution in the app’s Additional Runtime Settings area.
-f filename    
Use the specified options file, filename, when calling mbuild.
mbuild -setup is recommended.
-g    
Generate debugging information.
None
-G    
Same as -g
None
-I directory    
Add folder to search path for MATLAB files.
 
-K    
Directs mcc to not delete output files if the compilation ends prematurely, due to error.
mcc's default behavior is to dispose of any partial output if the command fails to execute successfully.
-l    
Macro to create a function library.
Equivalent to -W lib -T link:lib
-m    
Macro to generate a standalone application.
Equivalent to -W main -T link:exe
-M string    
Pass string to mbuild.
Use to define compile-time options.
-N    
Clear the path of all but a minimal, required set of folders.
None
-o outputfile    
Specify name of final output file.
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 MATLAB Runtime.
option = -nojvm, -nodisplay, -logfile filename, -startmsg, and -completemsg filename
-S    
Create Singleton MATLAB Runtime.
Default for generic COM components. Valid for Microsoft® Excel and Java® packages.
-T    
Specify the output target phase and type.
Default is codegen.
-u    
Registers COM component for current user only on development machine
Valid only for generic COM components and Microsoft Excel add-ins
-v    
Verbose; display compilation steps.
 
-w option
Display warning messages.
option = list, level, or level:string
where
level = disable, enable, error, off:string, or on:string
-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 MATLAB Compiler license.
The -Y flag works only with the command-line mode.
>>!mcc -m foo.m -Y license.lic
-?    
Display help message.
 


遇到的问题: 

问题1

android 可执行文件获取系统服务 app可执行文件_开发语言_05

问题2:

android 可执行文件获取系统服务 app可执行文件_开发语言_06


问题三:

已经包含了:gentl的adapter,但是,打包的时候

>> imaqhwinfo

ans = 

  包含以下字段的 struct:

    InstalledAdaptors: {'gentl'}
        MATLABVersion: '9.7 (R2019b)'
          ToolboxName: 'Image Acquisition Toolbox'
       ToolboxVersion: '6.1 (R2019b)'

但是,用Mcc -m编译的话依旧出错:

android 可执行文件获取系统服务 app可执行文件_android 可执行文件获取系统服务_07


问题4 

mcc -o MainGui -W 'WinMain:MainGui,version=1.0' -T link:exe -d H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_testing -v H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m -r 'D:\Program Files\Polyspace\R2019b\toolbox\compiler\Resources\default_icon.ico' -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl 
Compiler version: 7.1 (R2019b)

Dependency analysis by REQUIREMENTS.

Parsing file "H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m"
    (referenced from command line).
Generating file "H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_testing\readme.txt".
正在打包...
Creating the bundle...
Creating the install agent URL file...
Failed to embed install agent URL file, H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui\for_redistribution\installAgentURL.txt, in the installer.
Update resource failed: 5
Failed to embed unzip in your application.
Update resource failed: 5
Failed to create the web based installer.
No installer package created. 


问题5 

MainGui Executable

1. Prerequisites for Deployment 

Verify that version 9.7 (R2019b) of the MATLAB Runtime is installed.   
If not, you can run the MATLAB Runtime installer.
To find its location, enter
  
    >>mcrinstaller
      
at the MATLAB prompt.
NOTE: You will need administrator rights to run the MATLAB Runtime installer. 

Alternatively, download and install the Windows version of the MATLAB Runtime for R2019b 
from the following link on the MathWorks website:

    https://www.mathworks.com/products/compiler/mcr/index.html    
For more information about the MATLAB Runtime and the MATLAB Runtime installer, see 
"Distribute Applications" in the MATLAB Compiler documentation  
in the MathWorks Documentation Center.

2. Files to Deploy and Package

Files to Package for Standalone 
================================
-MainGui.exe
-MCRInstaller.exe 
    Note: if end users are unable to download the MATLAB Runtime using the
    instructions in the previous section, include it when building your 
    component by clicking the "Runtime included in package" link in the
    Deployment Tool.
-This readme file 

3. Definitions

For information on deployment terminology, go to
https://www.mathworks.com/help and select MATLAB Compiler >
Getting Started > About Application Deployment >
Deployment Product Terms in the MathWorks Documentation
Center.

android 可执行文件获取系统服务 app可执行文件_matlab_08


Preparing Runtime...
mcc -o Tyre_check -W 'WinMain:Tyre_check,version=1.0' -T link:exe -d H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\Tyre_check\for_testing -v H:\工作\感维科技\外包项目\通过式轮胎检测\SW\CamerGui\MainGui.m -r 'D:\Program Files\Polyspace\R2019b\toolbox\compiler\Resources\default_icon.ico' -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl 
Compiler version: 7.1 (R2019b)

Dependency analysis by REQUIREMENTS.

Parsing file "H:\MainGui.m"
    (referenced from command line).
Generating file "H:\SW\CamerGui\Tyre_check\for_testing\readme.txt".
正在打包...
Creating the bundle...
Creating installer zip archive due to contents exceeding maximum Windows program size.
Self contained installer created at H:\for_redistribution\MyAppInstaller_mcr.zip.
Packaging complete.
Elapsed packaging time was: 3 minutes and 55 seconds.


【案,注意绿色部分,其实是mcc 应用的一些参数的办法】 

【如果要调用Gentl Adapter,我做了一点改写的工作就,-a 后面就是调用了adapter】

>> mcc -m -a C:\ProgramData\MATLAB\SupportPackages\R2019b\toolbox\imaq\supportpackages\gentl MainGui.m

【案,问题的原因是,我安装的地方是一个USB 移动硬盘,而移动硬盘上的文件大小有限制,把他转移到电脑的硬盘上就好了】 


 【如果runtim 版本错误,即使安装好了打包的应用程序,运行的时候,任然会报错】

 

android 可执行文件获取系统服务 app可执行文件_MATLAB_09

 【案,在程序的打包文件夹里说明文件,有个提示】

android 可执行文件获取系统服务 app可执行文件_matlab_10

我们在命令行里面输入“mcrinstaller” 

>> mcrinstaller

ans =

  'C:\Users\frank_sj\AppData\Local\Temp\frank_sj\MCRInstaller9.7\MATLAB_Runtime_R2019b_win64.zip'

 这里提示一个安装包,我们把他替换成也是之前要求的版本就好了。

【案,正确的版本可以依据要求直接在官网下载】

android 可执行文件获取系统服务 app可执行文件_外包_11


 笔者搞了很久不行,最后还是在线下载解决了这个问题:

android 可执行文件获取系统服务 app可执行文件_android 可执行文件获取系统服务_12