I'd like to make a Feature Request for a new directive #if exists ( #include "filename.h" ) #endif. Here is example: #if exists ( "immintrin.h" ) #include "immintrin.h" #endif The directive should verify that some file exists in a folder and if Yes should set a "condition-variable" to true. Isn't that a good thing? Please consider and thank you in advance. Best regards, Sergey
If you really think this is a useful new C/C++ language/preprocessor feature I would suggest you propose this to the C and/or C++ standard committees.
Although Intel has implemented some of its own language extensions, these are generally performance extensions to take advantage of Intel chips (like parallel features). And even then we try to get them standardized so users will be able to use them and still have portable code.
Consider writing a Batch or Shell script that runs prior to compilation that creats a header file (header_exists.h) and which you include into your program.
echo // header_exists.h > header_exists.h
if exist immintrin.h echo _immintrin_exist_ > header_exists.h
Set your VS build properties to run the script before compilation.
In you application
#if defined( _immintrin_exist_)