Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22104

How to print defined macros with pragma to get OS version?

$
0
0

Following these related questions (1,2,3), I'm trying to get OS information from the preprocessor as follows:

#include <boost/preprocessor/stringize.hpp>#ifdef __MACH__#pragma message ("MACH: " BOOST_PP_STRINGIZE(__MACH__) )#endif

clang 13.1.6 prints:

warning: MACH: 1 [-W#pragma-messages]#pragma message ("MACH: " BOOST_PP_STRINGIZE(__MACH__) )

and gcc 11.3.0 :

note: '#pragma message: MACH: 1'4 | #pragma message ("MACH: " BOOST_PP_STRINGIZE(__MACH__) )

This tells me that the macro __MACH__ is defined, but I don't get details about the OS version.

I want to print the version of the operating system or print all the macros that are defined using the preprocessor.


Viewing all articles
Browse latest Browse all 22104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>