gpt4 book ai didi

c++14 - Emscripten 和 C++14

转载 作者:行者123 更新时间:2023-12-02 11:40:49 26 4
gpt4 key购买 nike

我正在使用 clang 3.4 和最新版本的 emscripten。

如果我尝试使用 C++14 编译 Hello World

emcc main.cpp -std=c++1y -o test.html

Emscripten 可以与 C++14 一起使用吗?

错误:

In file included from main.cpp:1:
In file included from /usr/share/emscripten/system/include/libcxx/iostream:38:
In file included from /usr/share/emscripten/system/include/libcxx/ios:216:
In file included from /usr/share/emscripten/system/include/libcxx/__locale:15:
In file included from /usr/share/emscripten/system/include/libcxx/string:439:
In file included from /usr/share/emscripten/system/include/libcxx/algorithm:627:
In file included from /usr/share/emscripten/system/include/libcxx/memory:601:
/usr/share/emscripten/system/include/libcxx/__functional_base:72:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
In file included from main.cpp:1:
In file included from /usr/share/emscripten/system/include/libcxx/iostream:38:
In file included from /usr/share/emscripten/system/include/libcxx/ios:216:
In file included from /usr/share/emscripten/system/include/libcxx/__locale:18:
In file included from /usr/share/emscripten/system/include/libcxx/mutex:177:
/usr/share/emscripten/system/include/libcxx/functional:506:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:531:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:556:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:581:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:606:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:631:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_Tp&& __x) const
^
/usr/share/emscripten/system/include/libcxx/functional:656:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:681:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:706:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:733:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:758:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:783:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:808:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:833:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_Tp&& __x) const
^
/usr/share/emscripten/system/include/libcxx/functional:858:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:883:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:908:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_T1&& __t, _T2&& __u) const
^
/usr/share/emscripten/system/include/libcxx/functional:929:10: error: constexpr function's return type 'auto' is not a literal type
auto operator()(_Tp&& __x) const
^
19 errors generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting

最佳答案

更新:从版本 1.28 开始 Emscripten 使用 Clang 3.4,因此该版本中提供了 C++14 功能!

Emscripten 的 LLVM + Clang 实现 Fastcomp 目前基于 Clang 3.3(Emscripten 版本 1.26)。所以答案是否定的,Emscripten 目前不适用于 C++14。

关于c++14 - Emscripten 和 C++14,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26103867/

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