fatal error C1083: Cannot open source file: '..\..\..\..\Program Files\MATLAB\R2017a\rtw\c\src\common\rt_main.c': No such file or directory [Using Code Generation in Simulink]
Mostrar comentarios más antiguos
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 comentarios
Fangjun Jiang
el 15 de Mzo. de 2021
You mean the building is fine in Simulink but not in VC 2012 directly?
Rasmus Visgaard
el 15 de Mzo. de 2021
Fangjun Jiang
el 15 de Mzo. de 2021
Okay, I think you can "generate code" fine in Simulink but not "build", because you had those "build" errors in MATLAB Command window.
It surprised me that I found only rt_main.c in R17b and R18b folders but not rt_main.cpp file.
Where did you find the file and can you open it to look at the "abstract" at the begining of the file?
Rasmus Visgaard
el 15 de Mzo. de 2021
Fangjun Jiang
el 15 de Mzo. de 2021
Noted "* File: rt_main.c"?? not rt_main.cpp. Check the date for the file to see if it matches the date of other original files.
Rasmus Visgaard
el 15 de Mzo. de 2021
Rasmus Visgaard
el 16 de Mzo. de 2021
Fangjun Jiang
el 16 de Mzo. de 2021
restore the original files (or try just rename the .cpp files to .c) and try again. CPP application can with with C files.
Rasmus Visgaard
el 16 de Mzo. de 2021
Rasmus Visgaard
el 19 de Mzo. de 2021
Respuestas (0)
Categorías
Más información sobre Target Language Compiler en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!