You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wa compile throws 4 errors when trying to compile a c++ file that imports the webassembly header.
You can reproduce it by copying the example code in the readme into a file named program.cpp and trying to run wa compile -o program.wasm program.cpp.
Output:
Compiling on darwin-x64 ...
clang program.cpp
-c
--target=wasm32-unknown-unknown
-emit-llvm
-nostdinc
-nostdlib
-D WEBASSEMBLY
-isystem /Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include
-o /var/folders/ts/rnwyskln05vg3cbkgl5d4s5xb72qlv/T/wa1_1788ixvKyawdM9VX.tmp
In file included from program.cpp:1:
In file included from /Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/webassembly.h:16:
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:17:35: error: C++ requires a type specifier for all declarations
size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:18:17: error: unknown type name 'char16_t'
size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:20:35: error: C++ requires a type specifier for all declarations
size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:21:17: error: unknown type name 'char32_t'
size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
^
4 errors generated.
I've also tried extern "C" the header with the same result (and it looks like you've externed all the header files anyway.)
I should also note that I'm very new to c, cpp and learning just to play with wasm so it's very likely that I've made a silly error.
The text was updated successfully, but these errors were encountered:
In the current state of this project, C++ support is still far away. It's specifically targeting C only and also doesn't include any sort of C++ standard library.
For now you are better off using emscripten if C++ support is of importance to you.
wa compile
throws 4 errors when trying to compile a c++ file that imports the webassembly header.You can reproduce it by copying the example code in the readme into a file named
program.cpp
and trying to runwa compile -o program.wasm program.cpp
.Output:
I've also tried
extern "C"
the header with the same result (and it looks like you've externed all the header files anyway.)I should also note that I'm very new to c, cpp and learning just to play with wasm so it's very likely that I've made a silly error.
The text was updated successfully, but these errors were encountered: