fatal error C1083: Cannot open source file: '..\..\..\..\Program Files\MATL​AB\R2017a\​rtw\c\src\​common\rt_​main.c': No such file or directory [Using Code Generation in Simulink]

4 Ansichten (letzte 30 Tage)
I am trying to build my Simulink model using Visual Studio 2012 c++ compiler which is building just fine. However, included in the project are two .c files, namely:
rt_main.c
rt_logging.c
And when I try to build the model in Visual Studio 2012, it gives me the error that is in the title. In the directory '..\..\..\..\Program Files\MATLAB\R2017a\rtw\c\src\common\rt_main.c': I cannot find a file named rt_main.c, but I can find one named rt_main.cpp. Same for the rt_logging.c file. I've tried changing names either places without luck.
1) Why are .c files included in the project, when I have specificed in the Code Generation Options that the system target file is grt.tlc [Create Visual C/C++ Solution File for Simulink Coder] with c++ language?
2) How can I make Simulink build using the rt_main.cpp file?
If I uncheck the box "Generate Code Only" in Configuration Parameters -> Code Generation -> Build Process, it gives me the errors:
1>------ Build started: Project: SimulinkModelDLL, Configuration: Debug x64 ------
1>Build started 15-03-2021 12:01:44.
1>InitializeBuildStatus:
1> Creating "x64\Debug\SimulinkModelDLL.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> rt_main.c
1>c1 : fatal error C1083: Cannot open source file: '..\..\..\..\Program Files\MATLAB\R2017a\rtw\c\src\common\rt_main.c': No such file or directory
1> rt_logging.c
1>c1 : fatal error C1083: Cannot open source file: 'rt_logging.c': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.12
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  10 Kommentare
Rasmus Visgaard
Rasmus Visgaard am 16 Mär. 2021
I tried to rename .cpp files to .c and tried again. I got the following error:
I have renamed some directories for proprietary reasons to XXXXX.
Build started 16-03-2021 13:29:46.
1>Project "C:\XXXXXX\Bladed\SimulinkModelDLL_grt_rtw\msvc\SimulinkModelDLL.vcxproj" on node 2 (Build target(s)).
1>InitializeBuildStatus:
Creating "x64\Debug\SimulinkModelDLL.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\CL.exe /c /IC:\XXXXXX\Bladed /I"C:\Program Files\MATLAB\R2017a\simulink\include\sf_runtime" /IC:\XXXXXX\Bladed\SimulinkModelDLL_grt_rtw /I"C:\Program Files\MATLAB\R2017a\extern\include" /I"C:\Program Files\MATLAB\R2017a\simulink\include" /I"C:\Program Files\MATLAB\R2017a\rtw\c\src" /I"C:\Program Files\MATLAB\R2017a\rtw\c\src\ext_mode\common" /Zi /nologo /W2 /WX- /Od /D WIN32 /D _DEBUG /D _CONSOLE /D MODEL=SimulinkModelDLL /D NUMST=1 /D NCSTATES=0 /D HAVESTDIO= /D RT= /D USE_RTMODEL= /D MAT_FILE=1 /D INTEGER_CODE=0 /D MT=0 /D CLASSIC_INTERFACE=0 /D ALLOCATIONFCN=0 /D ONESTEPFCN=1 /D TERMFCN=1 /D MULTI_INSTANCE_CODE=0 /D TID01EQ=0 /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"x64\Debug\\" /Fd"x64\Debug\vc110.pdb" /Gd /TC /errorReport:prompt "..\..\..\..\Program Files\MATLAB\R2017a\rtw\c\src\common\rt_main.c" "..\..\..\..\Program Files\MATLAB\R2017a\rtw\c\src\rt_logging.c"
rt_main.c
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtgmath.h(111): warning C4602: #pragma pop_macro : 'new' no previous #pragma push_macro for this identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(28): error C2061: syntax error : identifier 'acosf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(28): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(28): error C2061: syntax error : identifier 'asinf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(29): error C2061: syntax error : identifier 'atanf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(29): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(29): error C2061: syntax error : identifier 'atan2f'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(29): error C2061: syntax error : identifier 'ceilf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(30): error C2061: syntax error : identifier 'cosf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(30): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(30): error C2061: syntax error : identifier 'coshf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(30): error C2061: syntax error : identifier 'expf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(31): error C2061: syntax error : identifier 'fabsf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(31): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(31): error C2061: syntax error : identifier 'floorf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(31): error C2061: syntax error : identifier 'fmodf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(32): error C2061: syntax error : identifier 'frexpf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(32): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(32): error C2061: syntax error : identifier 'ldexpf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(32): error C2061: syntax error : identifier 'logf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(33): error C2061: syntax error : identifier 'log10f'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(33): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(33): error C2061: syntax error : identifier 'modff'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(33): error C2061: syntax error : identifier 'powf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(34): error C2061: syntax error : identifier 'sinf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(34): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(34): error C2061: syntax error : identifier 'sinhf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(34): error C2061: syntax error : identifier 'sqrtf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(35): error C2061: syntax error : identifier 'tanf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(35): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(35): error C2061: syntax error : identifier 'tanhf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(37): error C2061: syntax error : identifier 'acosl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(37): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(37): error C2061: syntax error : identifier 'asinl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(38): error C2061: syntax error : identifier 'atanl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(38): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(38): error C2061: syntax error : identifier 'atan2l'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(38): error C2061: syntax error : identifier 'ceill'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(39): error C2061: syntax error : identifier 'cosl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(39): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(39): error C2061: syntax error : identifier 'coshl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(39): error C2061: syntax error : identifier 'expl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(40): error C2061: syntax error : identifier 'fabsl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(40): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(40): error C2061: syntax error : identifier 'floorl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(40): error C2061: syntax error : identifier 'fmodl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(41): error C2061: syntax error : identifier 'frexpl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(41): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(41): error C2061: syntax error : identifier 'ldexpl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(41): error C2061: syntax error : identifier 'logl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(42): error C2061: syntax error : identifier 'log10l'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(42): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(42): error C2061: syntax error : identifier 'modfl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(42): error C2061: syntax error : identifier 'powl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(43): error C2061: syntax error : identifier 'sinl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(43): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(43): error C2061: syntax error : identifier 'sinhl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(43): error C2061: syntax error : identifier 'sqrtl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(44): error C2061: syntax error : identifier 'tanl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(44): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(44): error C2061: syntax error : identifier 'tanhl'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(46): error C2061: syntax error : identifier 'abs'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(46): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(48): error C2061: syntax error : identifier 'acos'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(48): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(48): error C2061: syntax error : identifier 'asin'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(49): error C2061: syntax error : identifier 'atan'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(49): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(49): error C2061: syntax error : identifier 'atan2'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(49): error C2061: syntax error : identifier 'ceil'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(50): error C2061: syntax error : identifier 'cos'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(50): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(50): error C2061: syntax error : identifier 'cosh'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(50): error C2061: syntax error : identifier 'exp'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(51): error C2061: syntax error : identifier 'fabs'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(51): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(51): error C2061: syntax error : identifier 'floor'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(51): error C2061: syntax error : identifier 'fmod'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(52): error C2061: syntax error : identifier 'frexp'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(52): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(52): error C2061: syntax error : identifier 'ldexp'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(52): error C2061: syntax error : identifier 'log'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(53): error C2061: syntax error : identifier 'log10'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(53): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(53): error C2061: syntax error : identifier 'modf'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(53): error C2061: syntax error : identifier 'pow'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(54): error C2061: syntax error : identifier 'sin'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(54): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(54): error C2061: syntax error : identifier 'sinh'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(54): error C2061: syntax error : identifier 'sqrt'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(55): error C2061: syntax error : identifier 'tan'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(55): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(55): error C2061: syntax error : identifier 'tanh'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(57): error C2061: syntax error : identifier 'hypot'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(57): error C2059: syntax error : ';'
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath(57): error C2061: syntax error : identifier 'hypotf'
rt_logging.c
Generating Code...
1>Done Building Project "C:\XXXXX\Bladed\SimulinkModelDLL_grt_rtw\msvc\SimulinkModelDLL.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:00.58
Rasmus Visgaard
Rasmus Visgaard am 19 Mär. 2021
Some further insight:
I tried changing the Simulink option to generate c-code, and I can both generate the code and build it using visual studio 2012 without problems. The issue seems to be, that if I want Simulink to generate c++ code, it's trying to locate rt_main.c and compile it as c++ for some reason. Changing the name of rt_main.c to rt_main.cpp does not help either, as it is, for another reason unknown, trying to locate the rt_main.c file which no longer exists.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by