emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3.03k stars 693 forks source link

No member named 'memcmp' in the global namespace on Windows #845

Open vaaneeunbnd opened 3 years ago

vaaneeunbnd commented 3 years ago

I am trying to port my c++ code to wasm and I am getting the following error on Windows-:

user/emsdk\upstream\emscripten\cache\sysroot/include/c++/v1\cstring:75:9: error: no member named 'memcmp' in the global namespace; did you mean 'wmemcmp'? using ::memcmp; ~~^ However I don't get this error on MacOS.

I am using the latest emsdk update and my gcc version is gcc.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0

I am not sure what am I doing wrong. I will be grateful if you could please help me with it.

Thanks :)

sbc100 commented 3 years ago

Can you give the full failing emcc command line? Can the full error output? Does this happen when you simply #include <cstring> and nothing else?

The most likely cause is that you are adding include paths (via -I) that point to system headers which are not compatible with emscripten.

vaaneeunbnd commented 3 years ago

Hey,

Thanks for getting back to me. I am not including in any of my files and this error is happening only on the windows machine. I tested it on the Mac OS and it works fine. Below is the error log: Capture-emsdk-error-log

Thanks :)

sbc100 commented 3 years ago

It looks like you have file called string.h in your include path (in 3rdparty/bx/include/bx). This will have the effect of overriding the system header string.h. I don't think that can work (even outside of emscripten), at least not unless that version of string.h is somehow compatible with the system string.h.