简体   繁体   English

我怎么知道我应该使用哪个C ++标准版本来构建哪个版本的Boost?

[英]How do I know which C++ standard version I should use to build which version of Boost?

When you download the Boost sources, there's no indication of which C++ language standard version you should be using to build it. 下载Boost源代码时,没有迹象表明您应该使用哪种C ++语言标准版本来构建它。 But - clearly there's no auto-selection, since if you don't set, say, at least --std=c++11 then some configuration checks for C++11 features fail. 但是 - 显然没有自动选择,因为如果你没有设置,比如至少--std=c++11那么对C ++ 11功能的一些配置检查就会失败。 So it's up to you, the builder, to set that. 因此,建筑师可以自行决定。

But - how do I know which C++ standard version to use for which Boost version? 但是 - 我如何知道哪个C ++标准版本用于哪个Boost版本? Is there like a table somewhere? 某处有桌子吗?

Specifically, I just built Boost 1.62.0 with --std=c++14 and got innumerable warnings about the use of sts::auto_ptr which is deprecated. 具体来说,我刚刚使用--std = c ++ 14构建了Boost 1.62.0,并且有关使用不推荐使用的sts::auto_ptr无数警告。 So, should I have stuck with C++11? 那么,我应该坚持使用C ++ 11吗? How can I tell? 我该怎么说?

Unfortunately, some boost developers haven't updated their implementation with the newest standards (even C++11) with the problems that you present. 不幸的是,一些提升开发人员没有使用最新标准(甚至是C ++ 11)更新他们的实现,并解决了您提出的问题。 There is a boost_config set of macros that can be used for keeping up with compatibility. 有一组boost_config宏可用于保持兼容性。

But usually the problem with the compilers is using an older one not newer. 但通常编译器的问题是使用较旧的编译器而不是更新版本。

Warnings are no errors. 警告没有错误。 C++14 supports std::auto_ptr with no restrictions. C ++ 14支持std :: auto_ptr,没有任何限制。 So you can use C++14, but you should not use std::auto_ptr in your new code. 所以你可以使用C ++ 14,但你不应该在新代码中使用std :: auto_ptr。 You should also not use std::auto_ptr with C++11. 您也不应该将std :: auto_ptr与C ++ 11一起使用。 EDIT: Since the OP didn't get the glue. 编辑:由于OP没有得到胶水。 If both support it, it makes no difference and he can use which one he likes. 如果两者都支持它,它没有任何区别,他可以使用他喜欢的那个。

Dont know about the Boost but you can get the c++ version from any c++ compiler like this - 不知道Boost但你可以从任何c ++编译器获得c ++版本 -

 if( __cplusplus == 201103L ) std::cout << "C++11 " ;
 if( __cplusplus == 199711L ) std::cout << "C++98 " ;
   //... like this 

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

相关问题 我应该在c ++ visual-studio-2005中使用哪个版本的boost? - Which version of boost should I use with c++ visual-studio-2005? 我应该在支持C ++ 03的编译器中使用哪个Boost版本? - Which Boost version should I use with a C++03-capable compiler? 当使用-lstdc ++构建cpp文件时,如何知道哪个c ++版本是uesd - how to know which c++ version is uesd when use -lstdc++ to build cpp file 如何指定要链接到哪个版本的Boost库? - How do I specify, which version of boost library to link to? 我使用的是哪个版本的C ++? - Which version of C++ am I using? 我怎么知道我在VS2008中正在构建哪个C ++程序版本? - How could I know which bit-version of C++ program I'm building in VS2008? cppwinrt.exe 工具如何知道使用哪个 C++ 版本从 .winmd 文件生成标头? - How cppwinrt.exe tool know which C++ version to use to generate the headers from .winmd files? 如何在 C++ 中构建与运行时版本无关的 DLL? - How do I build a runtime version agnostic DLL in C++? 使用vcpkg,如何使用其他c ++标准构建boost? - With vcpkg how do I build boost using a different c++ standard? 如何知道使用哪个版本的openssl boost ssl - How to know which version of openssl boost ssl is using
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM