$ brew install emscripten
and setup by following the instruction after the installation.
compile any file with the -v
options, get the pathes in the includes parts.
$ emcc -v test.c
...
#include <...> search starts here:
/usr/local/Cellar/emscripten/1.38.32/libexec/system/include/libcxx
/usr/local/Cellar/emscripten/1.38.32/libexec/system/lib/libcxxabi/include
/usr/local/Cellar/emscripten/1.38.32/libexec/system/include/compat
/usr/local/Cellar/emscripten/1.38.32/libexec/system/include
/usr/local/Cellar/emscripten/1.38.32/libexec/system/include/libc
/usr/local/Cellar/emscripten/1.38.32/libexec/system/lib/libc/musl/arch/emscripten
/usr/local/Cellar/emscripten/1.38.32/libexec/system/local/include
/usr/local/Cellar/emscripten/1.38.32/libexec/system/include/SDL
...
config vscode by setting "C_Cpp.default.includePath"
to the pathes above.
instead of include them all, we can just using wildcard **
to match them all.
"C_Cpp.default.includePath": [
"/usr/local/Cellar/emscripten/1.38.32/libexec/system/**",
]
now the vscode can find #include "emscripten.h"
in your C/C++