jeudi 30 novembre 2023

With C++11, how can I generate a warning message in a manner that works in gcc, clang, and MSVC?

When compiling C++11 using clang or gcc, I can generate a warning message at compilation time using:

#warning My message here

This doesn't work on Windows when I use MSVC, though. How can I intentionally generate a warning message that will work regardless of C++ compiler?

This question is not a duplicate of "preprocessor #warning equivalent in Visual C++?" because that question is not attempting to answer the question of how do it in a way that works across compilers.

Aucun commentaire:

Enregistrer un commentaire