关于Windows XP SP2 x86上不支持的两个C++11

编程知识 更新时间:2023-04-22 19:37:29

这个年代了还有人用Windows XP SP2 x86,我也是醉了。。。

这个bug估计很少有人遇到吧。

std::mutex和std::thread不支持在Windows XP SP2 x86上运行,会报入下图的错误GetLogicalProcessorInformation找不到:


我是在visula studio 2015上面选择Visual Studio 2015 - Windows XP (v140_xp)这种模式和运行库选择:多线程 (/MT) 的时候遇到的。

去掉std::mutex和std::thread以后,就可以在Windows XP SP2 x86上运行了。

c++ lamada表达式貌似可以随便使用。


看了微软的2015 c++for xp的介绍:

https://msdn.microsoft/en-us/library/jj851139.aspx

C++ runtime support

Along with the Windows XP platform toolset, the C Runtime Library (CRT), Standard Template Library (STL), Active Template Library (ATL), Concurrency Runtime Library (ConCRT), Parallel Patterns Library (PPL), Microsoft Foundation Class Library (MFC), and C++ AMP (C++ Accelerated Massive Programming) library include runtime support for Windows XP and Windows Server 2003. For these operating systems, the minimum supported versions are Windows XP Service Pack 3 (SP3) for x86, Windows XP Service Pack 2 (SP2) for x64, and Windows Server 2003 Service Pack 2 (SP2) for both x86 and x64.

估计std::mutex和std::thread最低需要 Windows XP Service Pack 2 (SP2) for x64。没找到x64的虚拟机。。。


另外还有一个奇葩的函数:_stat

struct _stat fileStat;
int result = _stat(directoryPath.c_str(), &fileStat);
return (result == 0) && (fileStat.st_mode & _S_IFDIR);
上面这个return 在某些情况下在Windows XP SP2上面和在Visula Studio 2013编译出来的某些情况下会返回失败,但是目录命名存在。

本人对这个函数理解不是很深刻。猜测可能是目录下面有文件(非文件夹)的原因。




更多推荐

关于Windows XP SP2 x86上不支持的两个C++11

本文发布于:2023-04-17 10:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/e133ec8f02bec8c70e953dabd5b785ba.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上不   两个   XP   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 82978文章数
  • 8367阅读数
  • 0评论数