gpt4 book ai didi

c++ - 如何使用 Visual Studio 2017 Linux 支持编译和构建 C++17 代码?

转载 作者:太空宇宙 更新时间:2023-11-04 12:51:59 24 4
gpt4 key购买 nike

Raspberry Pi project with VS2017

请有人解释如何使用 -std=c++1z 或 -std=c++ 编译和构建 C++ Blink 项目(VS2017 15.5.5 中的 Linux/Raspberry PI 项目)代码17 (g++),我设置了 raspberry 3 model B 和最新的 raspbian 操作系统,我成功连接并构建了我的代码并使用 C++11/C++14 标准(默认配置)运行,

Default standard provided

但我想用我的代码实现 C++17 特性,例如 std::variants/optional 等等。

我认为当前使用 VS2017 设置的 gcc 环境不支持 std::c++17,我将这些参数添加为项目 C/C++ -> 命令行参数,但所需的 header 和编译器支持不存在。

Enabling C++17/Latest support

Expected compile error

如何使用 VS2017 Crossplatform(Linux) 构建系统以及支持最新标准 (std=c++latest) 的外部 GCC/G++ 编译器将我的 C++17 标准代码编译并构建到 raspbian/Raspberry Pi 系统中?

谢谢。

最佳答案

Raspbian 自带的 GCC 版本已经过时,不完全支持 C++17。您需要安装更新版本的编译器。

网上有各种关于如何做到这一点的指南。 This one ,例如。

关于c++ - 如何使用 Visual Studio 2017 Linux 支持编译和构建 C++17 代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48678979/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com