Deepflea18
Deepflea18

Reputation: 45

Emcc compiling c++ files not compiling correctly

I used to have this:

void extra(int x){
   printf("Here's your number: %d\n", x);
}

EXTERN EMSCRIPTEN_KEEPALIVE void myFunction(int x){
    extra(x);
}

With a number input field and a button that would run myFunction with the value in the input field on pressing the button.

I have since changed it to:

// void extra(int x){
//     printf("Here's your number: %d\n", x);
// }

EXTERN EMSCRIPTEN_KEEPALIVE void myFunction(int x){
    printf("we're done!\n");
    //extra(x);
}

However, after compiling (using multiple commands, will get to that in a minute), pressing the button will still only output "Here's your number: [number]"

Commands I have tried:

emcc hello2.cpp -s STANDALONE_WASM -o hello2.wasm
emcc hello2.cpp -s STANDALONE_WASM
emcc -o hello2.html hello2.cpp -O3 -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']" (this updates my html file as well, which I don't want)
emcc -o hello2.js hello2.cpp -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']"

Upvotes: 0

Views: 107

Answers (0)

Related Questions