Solution 1:

It should be noted that MSVC uses the syntax:

#pragma message ( "your warning text here" )

The usual #warning syntax generates a fatal error

C1021: invalid preprocessor command 'warning'

so it is not portable to those compilers.

Solution 2:

It is likely that if a compiler doesn't support #warning, then it will issue an error. Unlike #pragma, there is no recommendation that the preprocessor ignore directives it doesn't understand.

Having said that, I've used compilers on various different (reasonably common) platforms and they have all supported #warning.