链接到使用旧版C ++标准编译的库是否安全? [英] Is it safe to link to libraries compiled with an older C++ standard?

查看:56
本文介绍了链接到使用旧版C ++标准编译的库是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C ++ 14标准编译了一堆库。即Boost,VTK和PCL。 PCL还包括仅头文件库Eigen。现在,我的项目需要一些C ++ 17的功能,所以我正在使用flag / std:c ++最新版本进行编译。我的
问题是,这会破坏与其他库的兼容性吗?如果是,我会得到编译时错误或警告,还是会编译成不安全的可执行文件?

解决方案

嗨< a href ="https://social.msdn.microsoft.com/profile/patatahooligan/?ws=usercard-mini\"target ="_ blank">
patatahooligan,


感谢您在此发布。


>>我使用C ++ 14标准编译了一堆库。即Boost,VTK和PCL。 PCL还包括仅头文件库Eigen。现在,我的项目需要一些C ++ 17的功能,所以我正在使用flag / std:c ++最新版本进行编译。
我的问题是,这会破坏与其他库的兼容性吗?如果是,我会收到编译时错误或警告,还是会编译成不安全的可执行文件?


这取决于您使用的功能。 最方便的方法是尝试。


/ std:c ++最新开关将推进Visual C ++实现的一组功能,每个新版本的C ++标准工作草案。目前,它将跟踪我们为拟议的后C ++ 14草案
标准添加的功能。当下一个标准被批准时,使用/ std:c ++最新选择的语义将由/ std:c ++ 17覆盖(假设下一个标准是C ++ 17,但是标准委员会工作组  ;永远不要惊讶)
和/ std:c ++最新将继续跟踪下一个草案标准的功能。换句话说,使用/ std:c ++ latest,您将始终获得当前实现的所有新功能的集合,默认情况下为。


有关版本切换的更多信息,请参阅以下文件。


https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/


<希望这可以帮助你。


最好的问候,

Sera Yu




I've compiled a bunch of libraries using the C++14 standard. Namely, Boost, VTK and PCL. PCL also includes the header-only library Eigen. Now, my project needs some C++17 features, so I'm compiling with the flag /std:c++latest. My question is, can this break compatibility with the other libraries? If it does, will I get a compile-time error or warning, or will it compile to an unsafe executable?

解决方案

Hi patatahooligan,

thanks for posting here.

>>I've compiled a bunch of libraries using the C++14 standard. Namely, Boost, VTK and PCL. PCL also includes the header-only library Eigen. Now, my project needs some C++17 features, so I'm compiling with the flag /std:c++latest. My question is, can this break compatibility with the other libraries? If it does, will I get a compile-time error or warning, or will it compile to an unsafe executable?

It depends on the features you use. The most convenience way is to have a try.

The /std:c++latest switch will move forward the set of features implemented by Visual C++ with each new version of the C++ standards Working Draft. Currently it will track features that we add for the proposed post-C++14 draft standard. When the next standard is approved, the semantics opted-in with the /std:c++latest will be covered by /std:c++17 (assuming that the next standard is C++17, but the standards committee working group never ceases to surprise) and /std:c++latest will move forward to track the next draft standard’s features. In another words, with /std:c++latest, you will always get the set of all new features currently implemented and on by default.

For more information about version switches, please refer to this document below.

https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/

Hope this could be help of you.

Best Regards,
Sera Yu


这篇关于链接到使用旧版C ++标准编译的库是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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