都2025年了,请问HarmonyOS鸿蒙Next官方计划什么时候完全支持c++17?

发布于 1周前 作者 htzhanglong 来自 鸿蒙OS

都2025年了,请问HarmonyOS鸿蒙Next官方计划什么时候完全支持c++17? 参考的官方ndk构建

CMakeList.txt如下

CMAKE_MINIMUM_REQUIRED(VERSION 3.15)

PROJECT(HELLO)

set(CMAKE_CXX_STANDARD 17)

add_definitions(-std=c++17)

ADD_EXECUTABLE(hello hello.cpp)

hello.cpp

#include <stdio.h>

int main()
{
    const bool a = std::is_floating_point_v<float>::value;
    printf("hello world!\n");
    return 0;
}

编译报错

C:\PROGRA~1\HuaWei\DEVECO~1\sdk\default\OPENHA~1\native\llvm\bin\CLANG_~1.EXE --target=aarch64-linux-ohos --gcc-toolchain="C:/Program Files/HuaWei/DevEco Studio/sdk/default/openharmony/native/llvm" --sysroot="C:/Program Files/HuaWei/DevEco Studio/sdk/default/openharmony/native/sysroot"   -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security   -D__MUSL__ -std=gnu++17 -fPIE   -std=c++17 -MD -MT CMakeFiles/hello.dir/hello.cpp.o -MF CMakeFiles\hello.dir\hello.cpp.o.d -o CMakeFiles/hello.dir/hello.cpp.o -c C:/hw/test/oh5cmake/hello.cpp
clang++: warning: argument unused during compilation: '--gcc-toolchain=C:/Program Files/HuaWei/DevEco Studio/sdk/default/openharmony/native/llvm' [-Wunused-command-line-argument]
C:/hw/test/oh5cmake/hello.cpp:5:25: error: no member named 'is_floating_point_v' in namespace 'std'
    const bool a = std::is_floating_point_v<float>::value;
                   ~~~~~^
C:/hw/test/oh5cmake/hello.cpp:5:50: error: expected '(' for function-style cast or type construction
    const bool a = std::is_floating_point_v<float>::value;
                                            ~~~~~^
C:/hw/test/oh5cmake/hello.cpp:5:53: error: no member named 'value' in the global namespace
    const bool a = std::is_floating_point_v<float>::value;
                                                  ~~^
3 errors generated.

请问,官方计划啥时候支持完整的c++17呢?


更多关于都2025年了,请问HarmonyOS鸿蒙Next官方计划什么时候完全支持c++17?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

同问

更多关于都2025年了,请问HarmonyOS鸿蒙Next官方计划什么时候完全支持c++17?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


截至2025年,HarmonyOS鸿蒙Next官方尚未明确公布完全支持C++17的具体时间表。鸿蒙系统主要采用ArkTS和JavaScript作为开发语言,C++支持更多地集中在底层开发和特定场景。如需最新信息,建议关注华为官方开发者公告或相关技术文档。

截至2025年,HarmonyOS鸿蒙Next已全面支持C++17标准。作为面向未来的操作系统,HarmonyOSNext在系统架构和开发工具链上进行了优化,确保开发者能够充分利用C++17的新特性进行高效开发。建议开发者访问华为开发者官网获取最新的开发文档和工具,以及相关的迁移指南和支持资源。

回到顶部
AI 助手
你好,我是IT营的 AI 助手
您可以尝试点击下方的快捷入口开启体验!