中易网

在windows下有没有对c++11支持比较好的

答案:2  悬赏:0  
解决时间 2021-02-28 15:05
在windows下有没有对c++11支持比较好的
最佳答案
装完毕后按如下方式设置:

工具-》编译选项-》代码生成/优化-》代码生成-》语言标准(选ISO C++11或者GNU C++11)-》确定
目前最新的g++是支持所有c++11特性的。
可能要加个编译选项 g++ -std=c++11
全部回答
获得windows版本getversion(windows xp、windows vista、windows 7、windows 2000、windows server 2003

写程序需要查看windows的版本号来决定程序如何操作,看到msdn的getversion 函数,这个函数返回一个dword的数据,然后自己对数据进行转换得到想要的具体值。

对应值如下:

operating system version number
windows 7 6.1
windows server 2008 r2 6.1
windows server 2008 6.0
windows vista 6.0
windows server 2003 r2 5.2
windows server 2003 5.2
windows xp 5.1
windows 2000 5.0

转自msdn的函数参考:

getversion function

operating system version

getversion function

retrieves the version number of the current operating system.

note   this function has been superseded by getversionex. new applications should use getversionex or verifyversioninfo.

syntax c++ dword winapi getversion(void); parametersthis function has no parameters. return value

if the function succeeds, the return value includes the major and minor version numbers of the operating system in the low-order word, and information about the operating system platform in the high-order word.

for all platforms, the low-order word contains the version number of the operating system. the low-order byte of this word specifies the major version number, in hexadecimal notation. the high-order byte specifies the minor version (revision) number, in hexadecimal notation. the high-order bit is zero, the next 7 bits represent the build number, and the low-order byte is 5.

remarks

the getversionex function was developed because many existing applications err when examining the packed dword value returned by getversion, transposing the major and minor version numbers. getversionex forces applications to explicitly examine each element of version information. verifyversioninfo eliminates further potential for error by comparing the required system version with the current system version for you.

examples

the following code fragment illustrates how to extract information from the getversion return value:

copy code #include <windows.h> #include <stdio.h> void main() { dword dwversion = 0; dword dwmajorversion = 0; dword dwminorversion = 0; dword dwbuild = 0; dwversion = getversion(); // get the windows version. dwmajorversion = (dword)(lobyte(loword(dwversion))); dwminorversion = (dword)(hibyte(loword(dwversion))); // get the build number. if (dwversion < 0x80000000) dwbuild = (dword)(hiword(dwversion)); printf("version is %d.%d (%d)\n", dwmajorversion, dwminorversion, dwbuild); }

the getversionex function retrieves the major and minor version numbers and other information about the currently running version of the operating system. the verifyversioninfo function enables you to determine whether the current system satisfies a specified set of operating system version conditions. for more information, see the following topics:

  • getting the system version
  • verifying the system version

the following table summarizes the most recent operating system version numbers.

operating system version number
windows 7 6.1
windows server 2008 r2 6.1
windows server 2008 6.0
windows vista 6.0
windows server 2003 r2 5.2
windows server 2003 5.2
windows xp 5.1
windows 2000 5.0

identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. this is because the operating system may have had new features added in a redistributable dll. rather than using getversionex to determine the operating system platform or version number, test for the presence of the feature itself.

to determine the best way to test for a feature, refer to the documentation for the feature of interest. the following list discusses some common techniques for feature detection:

  • you can test for the presence of the functions associated with a feature. to test for the presence of a function in a system dll, call the loadlibrary function to load the dll. then call the getprocaddress function to determine whether the function of interest is present in the dll. use the pointer returned by getprocaddress to call the function. note that even if the function is present, it may be a stub that just returns an error code such as error_call_not_implemented.
  • you can determine the presence of some features by using the getsystemmetrics function. for example, you can detect multiple display monitors by calling getsystemmetrics(sm_cmonitors).
  • there are several versions of the redistributable dlls that implement shell and common control features. for information about determining which versions are present on the system your application is running on, see the topic shell and common controls versions.

if you must require a particular operating system, be sure to use it as a minimum supported version, rather than design the test for the one operating system. this way, your detection code will continue to work on future versions of windows.

note that a 32-bit application can detect whether it is running under wow64 by calling the iswow64process function. it can obtain additional processor information by calling the getnativesysteminfo function.

我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
求好看的精神分裂片。不要很经典的,经典的几
这是什么机械键盘啊 我在网吧看到的 什么牌子
hello佣金提现需要实名认证吗
want to know some joke
应届毕业生考教师资格证需要学历证明还是学业
盛阳宾馆在什么地方啊,我要过去处理事情
广东省发改委价格监督检查与反垄断局怎么去啊
exo其中一人穿越古代的小说
邮政银行星期六上班吗?星期六能办理邮政银行
西华县医药公司奉母医药门市部这个地址在什么
银饰佩戴有什么讲究。
我的excel的表格是里有规划求解可是怎么不能
摔伤和对方扭伤能做出来妈
奎文区潍州路街道星河社区服务中心我想知道这
长春花怎么过冬
推荐资讯
辽箭坪村地址在哪,我要去那里办事
问耳机吧各位大佬,奥莱尔m1s和真男人的super
怎样种植中药材独角莲
手机百度地图路线上怎么不显示红绿灯
酷比5s格式化在哪里找
深圳(法务助理)的工资一般多少?
衬衣外穿件毛衣,要不要把领带夹在毛衣里去
DW中怎么加小框
怎么练习喝酒啊?
一九七五年农历六月十八生辰八字
景木怎么去啊,有知道地址的么
艺苑茶吧地址在哪,我要去那里办事
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?