Failed to generate all binary outputs问题的可能原因以及解决办法!

我们在使用simulink开发硬件的时候有时候会遇到Failed to generate all binary outputs.这样的问题,导致代码生成错误。我最近也遇到这个问题,搞了一个晚上,弄明白我这个过程中产生问题的原因。我是用simulink开发STM32,我的错误信息如下:

### Real-Time Workshop build procedure for method: 'entry
### modelName: 'STM32LED11
### gcs: 'STM32LED11
### bdroot: 'STM32LED11

### Starting Real-Time Workshop build procedure for model: STM32LED11
### Windows version:win64
### Model connectivity is: normal
### Create verification block: None
Code Generation  2  3
Elapsed: 46 sec
### Generating code into build folder: I:\STM32CubeMX\STM32LED11_stm32
Output port 2 of 'STM32LED11/Subsystem/ADC_Read' is not connected. [2 similar]
Component: Simulink | Category: Block warning
Parameter precision loss occurred for 'Value' of 'STM32LED11/Subsystem/Volt'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
Component: Simulink | Category: Block warning
----------->STM32 MCU:stm32f4
### Real-Time Workshop build procedure for method: 'before_tlc
### modelName: 'STM32LED11
### gcs: 'STM32LED11
### bdroot: 'STM32LED11
### before_tlc
### Invoking Target Language Compiler on STM32LED11.rtw
### Using System Target File: J:\MATLAB\STM32_MAT\STM32\rtw\stm32.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
Warning:  "---------->STM32_Config: MCU_Name is stm32f4"
.
### Caching model source code
Warning:  simMode value is 0.0
Warning:  Create real-time application main.c
.
### Writing source file STM32LED11.c
### Writing header file STM32LED11_private.h
.
### Writing header file STM32LED11.h
### Writing header file STM32LED11_ADC.h
### Writing source file STM32LED11_ADC.c
### Writing header file STM32LED11_USART.h
### Writing source file STM32LED11_USART.c
.
### Writing header file STM32_Config.h
### Writing header file STM32LED11_TIM.h
### Writing source file STM32LED11_TIM.c
### Writing header file STM32LED11_types.h
### Writing header file rtwtypes.h
.
### Writing source file STM32LED11_data.c
### Writing source file main.c
### TLC code generation complete.
### Real-Time Workshop build procedure for method: 'after_tlc
### modelName: 'STM32LED11
### gcs: 'STM32LED11
### bdroot: 'STM32LED11
### after_tlc
### Creating HTML report file STM32LED11_codegen_rpt.html
### Creating project marker file: rtw_proj.tmw
### Real-Time Workshop build procedure for method: 'before_make
### modelName: 'STM32LED11
### gcs: 'STM32LED11
### bdroot: 'STM32LED11

### Code Format : Embedded-C
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding source and include directories to make process.
STM32 package install path: J:\MATLAB\STM32_~1\STM32
- additional source directories:
J:\MATLAB\STM32_~1\STM32\addSrc\src
- additional include directories:
J:\MATLAB\STM32_~1\STM32\addSrc\inc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Using toolchain: MinGW64 v4.x | gmake (64-bit Windows)
### Creating 'I:\STM32CubeMX\STM32LED11_stm32\STM32LED11.mk' ...
### Building 'STM32LED11': J:\MATLAB\MATLAB~1\bin\win64\gmake -f STM32LED11.mk all

I:\STM32CubeMX\STM32LED11_stm32>cd .  

I:\STM32CubeMX\STM32LED11_stm32>if "" == "" (J:\MATLAB\MATLAB~1\bin\win64\gmake -f STM32LED11.mk all )  else (J:\MATLAB\MATLAB~1\bin\win64\gmake -f STM32LED11.mk  )  
J:\TDM-GC~1\bin/gcc -c -ansi -pedantic -Wno-long-long -fwrapv -O0 -DONESTEPFCN=1 -DTERMFCN=0 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DMODEL=STM32LED11 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -II:/STM32CubeMX/STM32LED11_stm32 -II:/STM32CubeMX -IJ:/MATLAB/MATLAB~1/extern/include -IJ:/MATLAB/MATLAB~1/simulink/include -IJ:/MATLAB/MATLAB~1/rtw/c/src -IJ:/MATLAB/MATLAB~1/rtw/c/src/ext_mode/common -IJ:/MATLAB/MATLAB~1/rtw/c/ert -IJ:/MATLAB/STM32_MAT/STM32/addSrc/inc -o "STM32LED11.obj" "STM32LED11.c"
In file included from STM32LED11.h:39:0, 
                 from STM32LED11.c:35: 
STM32LED11_ADC.h:38:1: error: C++ style comments are not allowed in ISO C90 
//RP MODIF #include "STM32LED11_STM32.h" 

STM32LED11_ADC.h:38:1: error: (this will be reported only once per input file) 
In file included from STM32LED11_ADC.h:39:0, 
                 from STM32LED11.h:39, 
                 from STM32LED11.c:35: 
STM32_Config.h:37:27: fatal error: stm32f4xx_hal.h: No such file or directory 
compilation terminated. 

gmake: *** [STM32LED11.obj] Error 1 

I:\STM32CubeMX\STM32LED11_stm32>echo The make command returned an error of 2  
The make command returned an error of 2 

I:\STM32CubeMX\STM32LED11_stm32>An_error_occurred_during_the_call_to_make 
'An_error_occurred_during_the_call_to_make' 不是内部或外部命令,也不是可运行的程序 
或批处理文件。
### Real-Time Workshop build procedure for method: 'error
### modelName: 'STM32LED11
### gcs: 'STM32LED11
### bdroot: 'STM32LED11
### Real-Time Workshop build procedure for model: 'STM32LED11' aborted due to an error.
Error(s) encountered while building "STM32LED11":

### Failed to generate all binary outputs.

错误信息中标红的部分是重点错误信息,分析原因大多数为内部资源错误,突然间想到前两天为了给S-function builder 里添加的C语言配置编译器而将MATLAB的编译器更改为MinGW64 Compiler (C) ,可能是这个导致的问题。

在MATLAB命令窗口输入mex -setup命令,调出MATLAB C语言编译器,将C语言编译器改为系统的编译器及解决上述报错信息问题。Failed to generate all binary outputs问题的可能原因以及解决办法!_第1张图片

你可能感兴趣的:(Failed to generate all binary outputs问题的可能原因以及解决办法!)