Questions tagged [cheerp]

Cheerp is a C/C++ to WebAssembly/JavaScript compiler. Ask about any problems you were faced while using it or any other relevant question. Cheerp should not not confused with the wireless communication technology Chirp.

is an Open Source C/C++ compiler that can convert C to and .

7 questions
27
votes
1 answer

invalid operands to binary expression ('std::ostream' (aka 'basic_ostream') and 'const char *')

When trying to compile my c++ code with Cheerp (using clang++), I get this output from my terminal: example.cpp:102:9: error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream') and 'const char *') out << "("…
Jonathan Allen Grant
  • 3,408
  • 6
  • 30
  • 53
4
votes
1 answer

How to preserve variable name in Cheerp (a C++ to JavaScript transpiler)

I'm using Cheerp (https://www.leaningtech.com/cheerp/) to transpile some C++ code into JavaScript. Is there any option to preserve variable names? Looks like the names get always mangled Original C++ code: void myClass::myMethod(int32_T myParam,…
Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
1
vote
1 answer

is it possible to use the emscripten wasm port of sdl in cheerp?

I started using cheerp recently and I would like to know if I can use the emscripten SDL library in cheerp or if there is an SDL port for cheerp
1
vote
1 answer

How to iterate over dynamically named objects in Cheerp/js?

Cheerp is a C++ to js/wasm transpiler. Using C++, I am able to interface with extern Javascript objects by statically defining a type and name of an object (and it's members). Take the following object as an example: var example1 = { "itemA" :…
Xunie
  • 437
  • 4
  • 21
1
vote
1 answer

How do I interface with extern variables from Cheerp/js?

Cheerp is a C++ to js/wasm transpiler. Screeps is a programming videogame. How do I read in the Game.time variable from my transpiled C++ code? (in screeps) #include #include using namespace std; namespace client { …
Xunie
  • 437
  • 4
  • 21
0
votes
1 answer

What C++ [[attributes]] are implemented by cheerp?

The C++11 specification defined [[attributes]] which can be used to specify/influence implementation-defined behavior. Cheerp supports this for specifying whether you're writing C++ code meant to be compiled into [[cheerp::genericjs]] or…
Xunie
  • 437
  • 4
  • 21
0
votes
1 answer

How do I load a cheerp-wasm program in absence of a 'path' module?

Cheerp has a cheerp-wasm target that compiles C++ to both a .js and its associated .wasm file. The way I understand it is that the .js file is effectively a loader for the webassembly. This loader calls require("path") to import required filesystem…
Xunie
  • 437
  • 4
  • 21