In gcc I can do compile-time warnings like this:
#if !defined(_SOME_FEATURE_)
#warning _SOME_FEATURE_ not defined-- be careful!
#endif
But in Visual Studio this doesn't work. Is there an alternative syntax for #warning?
In gcc I can do compile-time warnings like this:
#if !defined(_SOME_FEATURE_)
#warning _SOME_FEATURE_ not defined-- be careful!
#endif
But in Visual Studio this doesn't work. Is there an alternative syntax for #warning?
#pragma WEIRD_VALUES_HERE
is the way I've always seen it done. M$ probably has the pragmas on their site somewhere.
About the closest equivalent would be #pragma message
, or possibly #error
(the latter stops compilation, the former just prints out the specified error message).
Another thought is template style compile time asserts. Boost has a whole selection of these if you are wanting to check compile time code errors.