如何在代码块中启用c ++ 17支持 [英] how to Enable c++17 Support in code blocks

查看:110
本文介绍了如何在代码块中启用c ++ 17支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码块中Build或Compiler选项中没有C ++ 17选项,只有C ++ 14
我如何才能在代码块中启用它,以便编码工具和编译器都支持它? p>

in codeblocks There isn't a C++17 option in the Build or Compiler options, only C++14 how can i enable it in codeblocks so that both coding tools and compiler support it?

推荐答案

Code :: Blocks 不是是编译器(但有些荣耀的源代码编辑器,有时称自己为 IDE ,它会运行一些外部编译器)。

Code::Blocks is not a compiler (but some glorified source code editor, sometimes calling themselves IDEs, which runs some external compiler).

您需要一个 C ++ 17 编译器 (一旦获得,您可以进行配置您的IDE或编辑器以将其与适当选项一起使用)。尝试使用最新版本的 GCC (至少 GCC 7 ,也许要等到GCC 8)或 Clang (等待Clang5)并通过它 -std = c ++ 17 选项

You need a C++17 compiler (and once you've got one you might configure your IDE or editor to use it with the appropriate options). Try the very latest version of GCC (at least GCC 7, and perhaps wait for GCC 8) or Clang (wait for Clang5) and pass it the -std=c++17 option

请注意 C ++ 17 是将于2017年底发布的C ++标准。您可能需要稍等一下(也许一两年),以便编译器和标准库实现正确并完全实现它。

Note that C++17 is the C++ standard slated to be published by the end of 2017. You may need to wait a bit (perhaps a year or two) for compilers and the standard library implementations to correctly and completely implement it.

因此,我不建议在项目中使用C ++ 17功能即将在2017年末发布,因为您将以β质量为基础。但是,如果您正在开发一个将于2019年发布的大型项目,您可能会冒风险,认为您正在使用的C ++ 17功能到那时将变得成熟。

Therefore I don't recommend using C++17 features on a project to be released soon (at end of 2017), since you are then building on β quality foundations. However, if you work on a large project to be released in 2019, you might take the risk of betting that the C++17 features you are using in it will become mature by that time.

关于标准库功能(例如 std :: filesystem )您会轻易地找到大致等效的内容(例如,在本机OS或POSIX API中,在Boost中,在Qt中,在POCO中...),一旦通用了C ++ 17实现,就应该相当容易移植。

Regarding standard libraries functions (such as std::filesystem) you'll easily find approximate equivalent (e.g. in native OS or POSIX APIs, in Boost, in Qt, in POCO, ...) that should be reasonably easy to port once C++17 implementations are common.

(我建议在命令行上使用编译器,或使用 make 忍者 ,或其他运行编译器命令的构建自动化系统;详细信息可以是操作系统和特定于编译器的。 )

(I recommend using your compiler on the command line, or using make, ninja, or some other build automation system running compiler commands; details can be operating system and compiler specific.)

这篇关于如何在代码块中启用c ++ 17支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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