How do I include the experimental/filesystem C++ header in Simulink Real-Time custom code?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 3 de Feb. de 2023
Editada: MathWorks Support Team
el 10 de Oct. de 2025
When compiling custom C++ code for use in Simulink Real-Time R2022a, I receive a compiler error:
fatal error: experimental/filesystem: No such file or directory
on the include statement for the "experimental/filesystem" header. The "Language Standard" option in the configuration parameters is set to "C++11", which should have this library as part of its standard library.
Why can't I include "experimental/filesystem", and how can I use its functionality in my C++ code?
Respuesta aceptada
MathWorks Support Team
el 10 de Oct. de 2025
Editada: MathWorks Support Team
el 10 de Oct. de 2025
The standard library and headers available to the Simulink Real-Time compiler are determined by the Real-Time Operating System, which compiles and runs the custom code and model. Since R2020b, this is QNX Neutrino.
This is not affected by the "Language Standard" option in the configuration parameters, which only affects code generated from Simulink, not compiler options.
The "experimental/filesystem" library was renamed to just "filesystem" in the C++17 standard, so the following include statement works:
#include <filesystem>
Alternatively, you can use the Boost filesystem library with the following include statement:
#include <boost/filesystem.hpp>
The C++ filesystem library was directly based on the Boost filesystem library, so similar functionality is present. For more information on the C++ filesystem library and its history, refer to the following external links:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Troubleshooting in Simulink Real-Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!