C ++中的编译器版本,名称和操作系统检测 [英] Compiler version, name, and OS detection in C++

查看:389
本文介绍了C ++中的编译器版本,名称和操作系统检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用C ++检测操作系统名称,编译器名称和编译器版本,因为我需要更改每种情况的设置。

I need to detect the OS name, compiler name, and version of the compiler with C++, as I need to change the setup for each case.

我该如何做?

推荐答案

对于大多数编译器,您可以找到预定义宏的列表。

For most compilers you can find a list of predefined macros.

  • VS http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.80%29.aspx
  • gcc http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

这篇关于C ++中的编译器版本,名称和操作系统检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆