[英]Can gcc compile C++17 code with older third party libraries?
C++17 has removed several language and library features that were deprecated in C++11. C ++ 17删除了C ++ 11中不推荐使用的几种语言和库功能。
As a result, some older library headers that utilize exception specifications or register
variables outright don't compile. 结果,某些利用异常规范或直接register
变量的较旧的库头文件无法编译。
Does gcc have a flag to allow C++17 code to include features that were removed? gcc是否有一个标志允许C ++ 17代码包含已删除的功能?
Often, you can get back features removed from the language with -fpermissive
. 通常,您可以使用-fpermissive
获取从语言中删除的功能。 This is does not work for throw
specifiers in GCC7, which is arguably a bug, and you should report it as such. 这不适用于GCC7中的throw
说明符,这可以说是一个错误,您应该这样报告。 After all, -fpermissive
enables such goodies as implicit int
s. 毕竟, -fpermissive
启用诸如隐式int
的功能。
The register
removal results just in a warning for now, easily disabled with -Wno-register
. -Wno-register
删除register
仅会产生警告,可通过-Wno-register
轻松禁用。
auto_ptr and register should be warnings. auto_ptr和register应该是警告。 You could get them away with -Wno-register -Wno-deprecated-declarations. 您可以使用-Wno-register -Wno-deprecated-declaration删除它们。 I don't know if you could do something about the throw error. 我不知道您是否可以对抛出错误做些什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.