emscripten-core / emscripten-core/emscripten

Error While creating hello world with cout in c++

Open
#22,401 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hi,

I have tried the below simple c++ code

```
#include

int main() {
std::cout << "Hello World!\n";
return 0;
}
```

with command `emcc main.cpp -o file.wasm -s STANDALONE_WASM`

and `wasmtime file.wasm`

but I am getting

```
Error: failed to run main module `file.wasm`

Caused by:
0: failed to instantiate "file.wasm"
1: unknown import: `env::_tzset_js` has not been defined
```

I am using emscripten and wasmtime latest versions. Can you please help what I am doing wrong here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.