Simulink Code Generation build error question
Show older comments
I took Embedded coder generation course and I am practicing course example chapter 3.
I added to 1 line below and builded but errors happened!
What is the problem? I just followed the course textbook!
Let me know what should I do?
Thank you!
int_T main(int_T argc, const char *argv[])
{
/* Unused arguments */
(void)(argc);
(void)(argv);
int_T i; //<-------- 1 line added
/* Initialize model */
iir_external_initialize();
/* Attach rt_OneStep to a timer or interrupt service routine with
* period 0.01 seconds (the model's base sample time) here. The
* call syntax for rt_OneStep is
*
* rt_OneStep();
*/
printf("Warning: The simulation will run forever. "
"Generated ERT main won't simulate model step behavior. "
"To change this behavior select the 'MAT-file logging' option.\n");
fflush((NULL));
while (rtmGetErrorStatus(iir_external_M) == (NULL)) {
/* Perform other application tasks here */
}
/* Disable rt_OneStep() here */
/* Terminate model */
iir_external_terminate();
return 0;
}
===========================================================================================================
### Generated code for 'iir_external' is up to date because no structural, parameter or code replacement library changes were found.
### Using toolchain: Microsoft Visual C++ 2008 v9.0 | nmake (32-bit Windows)
### 'C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw\iir_external.mk' is up to date
### Building 'iir_external': nmake -f iir_external.mk all
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw>call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw>cd .
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw>if "" == "" (nmake -f iir_external.mk all ) else (nmake -f iir_external.mk )
Microsoft(R) Program Maintenance Utility 버전 9.00.21022.08
Copyright (c) Microsoft Corporation. All rights reserved.
cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_X86_=1 -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0500 -DNTDDI_VERSION=0x05000000 -D_WIN32_IE=0x0500 -DWINVER=0x0500 -D_MT -MT /wd4996 /fp:precise /Od /Oy- -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DMODEL=iir_external -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -Fo"ert_main.obj" "C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw\ert_main.c"
ert_main.c
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw\ert_main.c(76) : error C2143: 구문 오류 : ';'이(가) '형식' 앞에 없습니다.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : '0x2' 반환 코드입니다.
Stop.
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\class\coursefiles\slec\chapter03\iir_external_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.
============================================================================================================
Answers (1)
Walter Roberson
on 9 Jun 2015
This is a C++ question, not a MATLAB question.
The error message is that you are missing a ';' before a type on line 76 of ert_main.c . You do not appear to have 76 lines in the code you show us.
Other material suggests the error message is generated if you attempt to declare a variable after you have an executable statement. See https://msdn.microsoft.com/en-us/library/0afb82ta.aspx
In particular, your line
int_T i; //<-------- 1 line added
is after the lines
(void)(argc);
which is an executable line. You need to move your declaration to before that line. Or you need to upgrade to a newer C++ compiler.
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!