In C++ is it possible to check at compile time whether a file with the given name is withing the include path.
I am trying to set up a library which takes compiler settings from a user created file called for example config.h. If the file is not present, the library will default to a workable state.
I would like to do something such as this
#IFINCLUDED config.h
# include config.h
#else
# define defaultLibrarySettings
#endif
I guess a workaround would be to just do something like:
#include "config.h
#ifndef defaultLibrarySettings
# define defaultLibrarySettings
#endif
However the user still needs a "config.h file somewhere in there path, or else they will get an unresolved inclusion.
A final thought would be to do something like
#ifdef USE_EXTERNAL_SETTINGS
# include "config.h"
#else
# define defaultLibrarySettings
#endif
This however would require the user to #define USE_EXTERNAL_SETTINGS each time they included my library.
TLDR: is there a simple way to check if a file exists in the include path such as shown in my first example?
you could include and fill in config.h with your default library settings and allow the user to change them. This way the user is also presented with the allowable configurations