Everything
4.2.6.15 __has_include 【V2.08以降】
__has_include ("<ファイル名>")
__has_include (<<ファイル名>>)

プリプロセス処理で,__has_includeで指定した<ファイル>が存在する場合は1,存在しない場合は0として評価します。

__has_includeをマクロとして評価した場合,値は1となります。

__has_includeは#ifなどのプリプロセス指令でのみ使用することができます。それ以外で使用した場合にはエラーとなります。

 

#if defined(__has_include)
#if __has_include("existent_usr_header1.h")
#include "existent_usr_header1.h";
#endif 
#if __has_include(<existent_usr_header1.h>)
#include <existent_usr_header1.h>;
#endif
#endif

次の記述はエラーとなります。

int exists = __has_include("existent_usr_header1.h");