Emscripten: fatal error: 'tr1/unordered_map' file not found

Emscripten: fatal error: 'tr1/unordered_map' file not found

所以我正在尝试使用 emscripten 编译以下代码:

// this is test.cpp

#include<iostream>
#include<string.h>
#include<fstream>
#include<tr1/unordered_map> //needed to use unordered maps in C++. not needed C++11 onwards
#include "C:\Users\<myusername>\Documents\PROGRAMMING\examplefolder\pugixml-1.11\src\pugixml.hpp"

#include <ctime>
#include <chrono>

int main()
{
    std::cout<<"DIS IS DA TEST";
    return 0;
}

我的实际代码要大得多,但我在这里将其缩短以强调我的主要疑问(我已经留下了我正在使用的所有头文件)。此代码使用 g++ 完美编译并提供所有预期输出。

但是当我使用 emcc test.cpp -s WASM=1 -o TRY.html 将它编译为 web assembly 时,它给我这个错误:

test.cpp:4:9: fatal error: 'tr1/unordered_map' file not found
#include<tr1/unordered_map> //needed to use unordered maps in C++. not needed C++11 onwards
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
emcc: error: 'C:/Users/vargh/emsdk/upstream/bin\clang++.exe -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -Xclang -iwithsysroot/include/SDL -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=15 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -flegacy-pass-manager -Werror=implicit-function-declaration --sysroot=C:\Users\vargh\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\compat test.cpp -c -o C:\Users\<myusername>\AppData\Local\Temp\emscripten_temp_e9j9ld9x\test_0.o' failed (1)

为什么emcc找不到这个文件?在 C++ 中是否有另一种处理 unordered_maps 的方法?

我使用的是 tr1,因为我在 Stack Overflow 问题中遇到了同样的错误:C++ error: 'unordered_map' does not name a type

有人可以帮我吗?

Why is this file not found by emcc? Is there an alternate way to handle unordered_maps in C++?

因为它在 2011 年搬到了 <unordered_map>

如果这两个地方都没有,你有一个很老的叮当声,它没有unordered_map