Similarly, other operating systems have specific macro defined by the compiler.Įxample of checking Windows OS: #ifdef _WIN32 So, if the macro _WIN32 is defined, we are on Windows. For example, on Windows platform, the compiler has a special macro named _WIN32 defined. To check the operating system of the host in a C or C++ code, we need to check the macros defined by the compiler (GNU GCC or G++). Reading time: 30 minutes | Coding time: 5 minutes
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |