因此我正在尝试使用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程序集时,它给出了以下错误:
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时遇到了堆栈溢出问题中的相同错误:C++错误:'unordered_map'不命名类型
有人能帮我一下吗?
为什么EMCC没有找到这个文件?在C++中是否有处理unordered_maps的替代方法?
因为它在2011年转移到
。
如果这两个位置都不在,则会出现一个非常古老的clang,并且它没有unordered_map
。