Is is possible to use a header guard or something similar to detect if a header file is present or not?
#ifndef FILESYSTEM_INCLUDE_FILE_WHATEVER // add custom implementation #else #include <filesystem> #endif
No, you have to use make or some other external tool to do it.
Okie dokie. Thanks.
But you can still define macros that you can then check in your headers, like `gcc -DHAVE_THE_FILE=1 game.cpp` etc. Just in case you didn't know
You can use __has_include() since C++ 17.
You can use __has_include() since C++ 17.
Cool. I've been following the development of C++, but never noticed that feature.
Modern C++ has a lot of cool stuff. <filesystem> I really like. It's got some cool little conveniences like temp_directory_path, last_write_time.
I'm not a fan of the more permissive complex conventions. They seem to me to lead down the bad path of incompressible complexity.
As for __has_include(), that's awesome. I probably won't use that though. I should really figure out why <filesystem> isn't appearing on the other system rather than trying to patch around it.
Most likely they have older GCC installations. You could install Boost and use boost::filesystem (or whatever it's called), I think that's pretty much a drop-in replacement.
Hmm... Just make C++ 17 (with its standard headers) a requirement? They will come over time anyway.