Can the C preprocessor be used to tell if a file exists?

Little Update Some compilers might support __has_include ( header-name ). The extension was added to the C++17 standard (P0061R1). Compiler Support Clang GCC from 5.X Visual Studio from VS2015 Update 2 (?) Example (from clang website): // Note the two possible file name string formats. #if __has_include(“myinclude.h”) && __has_include(<stdint.h>) # include “myinclude.h” #endif Sources SD-6: … Read more

What are the applications of the ## preprocessor operator and gotchas to consider?

One thing to be aware of when you’re using the token-paste (‘##‘) or stringizing (‘#‘) preprocessing operators is that you have to use an extra level of indirection for them to work properly in all cases. If you don’t do this and the items passed to the token-pasting operator are macros themselves, you’ll get results … Read more

How, exactly, does the double-stringize trick work?

Yes, it’s guaranteed. It works because arguments to macros are themselves macro-expanded, except where the macro argument name appears in the macro body with the stringifier # or the token-paster ##. 6.10.3.1/1: … After the arguments for the invocation of a function-like macro have been identified, argument substitution takes place. A parameter in the replacement … Read more

Compile, Build or Archive problems with Xcode 4 (and dependencies)

NB: The steps below will solve 90% of your Xcode archive issues however, from the comments it is suggested you try quitting Xcode first. This may save you hours of setting tweaking. Check the “user header paths” are correct (Add “” to paths for spaces, both in your project and dependencies) Set “Always search user … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)