简体   繁体   English

MSVC 2010 是符合 C++11 标准的编译器吗

[英]Is MSVC 2010 a C++11-standard-compliant compiler

I was about to use google test for unit testing our MSVC 2010 based project, but the README.md file of the gtest v1.10.x branch (the current latest) mentions a C++11-standard-compliant compiler in the Build Requirements section.我正要使用谷歌测试为单元测试我们的MSVC 2010以项目为基础,但README.mdGTEST v1.10.x分支的文件(目前最新的)中提到的建立一个C ++ 11兼容的标准编译器要求部分。

So is MSVC 2010 a C++11-standard-compliant compiler, or should I rather use gtest v1.7.0 which mentions Microsoft Visual C++ 7.1 or newer in the Windows Requirements section?那么MSVC 2010是符合 C++11 标准的编译器,还是我应该使用gtest v1.7.0 ,它在Windows 要求部分提到了Microsoft Visual C++ 7.1 或更新版本

Around 2017, we had been facing too many random crashes with apps built using MSVC10 & MSVC11 compilers. 2017 年左右,我们在使用 MSVC10 和 MSVC11 编译器构建的应用程序中遇到了太多随机崩溃。 Upon analyzing this, we identified that the standard C++ library calls were the cause for the crashes though we did nothing wrong, and the code was perfectly written.经过分析,我们确定标准 C++ 库调用是导致崩溃的原因,尽管我们没有做错,并且代码编写得很完美。

After some struggle debugging and study, we identified that Microsoft's C++11 implementation was non standard and buggy, and caused unnecessary crashes .经过一番努力调试和研究,我们发现微软的 C++11 实现是非标准和错误的,并导致了不必要的崩溃 For us, even the basic wait_for call on condition_variable had random crashes.对我们来说,即使是对 condition_variable 的基本 wait_for 调用也会随机崩溃。 Here is one such MSDN reference for you. 这里有一份这样的 MSDN 参考资料供您参考。

We contacted Microsoft regarding this, and their reply was,我们就此事联系了微软,他们的答复是,

"I'm sorry, but no hotfixes for this bug are available. I strongly recommend upgrading to the latest released version of VS (currently VS 2017 15.4), as we have fixed many bugs in the STL's multithreading machinery over the years." “很抱歉,没有针对此错误的修补程序可用。我强烈建议升级到最新发布的 VS 版本(当前为 VS 2017 15.4),因为多年来我们已经修复了 STL 多线程机制中的许多错误。”

We had to move all our projects to VS2017 (The latest one at that time) to get rid of the crashes.我们不得不将所有项目转移到 VS2017(当时最新的项目)以摆脱崩溃。 I wouldn't recommend you using those buggy compilers either.我也不建议你使用那些有问题的编译器。

Better stick to older compilers(VC8/VC9) or move to the latest one (VS2019).最好坚持使用较旧的编译器(VC8/VC9)或迁移到最新的编译器(VS2019)。 We had no issues after migrating to VS2017.迁移到 VS2017 后我们没有问题。

No, MSVC 2010 is not fully C++11 compliant.不,MSVC 2010 不完全符合 C++11。 However, it does provide many C++11 features.但是,它确实提供了许多 C++11 功能。 You could try and compile the latest google_test with it, or just use an older version.您可以尝试用它编译最新的 google_test,或者只使用旧版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM