eos icon indicating copy to clipboard operation
eos copied to clipboard

atof、strtouf unresolveable

Open m8989 opened this issue 8 years ago • 9 comments

cleos set contract XXXX XXXXXX/XXXXXX Using already assembled WASM... Publishing contract... Error 3070000: WASM Exception Error Details: env.atof unresolveable ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pending console output: Stack Trace: wasm_interface.hpp:42 resolve wasm_interface.hpp:44 resolve apply_context.cpp:61 exec_one

m8989 avatar Aug 03 '18 03:08 m8989

same issue, can not convert string to float.

hama avatar Aug 03 '18 08:08 hama

Use strtof(), strtod(), or strtold(), all of which are available. The wcs variants are not available.

jgiszczak avatar Aug 03 '18 21:08 jgiszczak

I just tried to use strtod as follows: quantity = std::strtod(str_quantity.c_str(), nullptr);

When setting the contract, I get the following error:

Using already assembled WASM...
Publishing contract...
Error 3070000: WASM Exception
Error Details:
env.strtod unresolveable
pending console output: 

PhillipHamnett avatar Aug 06 '18 06:08 PhillipHamnett

Be sure your contract is linked against libc.bc. eosiocpp attempts to do this for you with the ${EOSIO_INSTALL_DIR}/usr/share/eosio/contractsdk/lib/libc.bc argument to llvm-link. The system contracts do it by adding the LIBRARIES libc argument to the add_wast_executable macro in their respective CMakeLists.txt.

jgiszczak avatar Aug 06 '18 22:08 jgiszczak

I got the same issue

JayJay1024 avatar Aug 28 '18 10:08 JayJay1024

Use eosio.wasmsdk as it has better support.

heifner avatar Aug 28 '18 12:08 heifner

how to use eosio.wasmsdk?

stev1988 avatar Sep 17 '18 02:09 stev1988

Eosio.wasmsk has been renamed to eosio.cdt. It can be found here: https://github.com/EOSIO/eosio.cdt. It includes some instructions. More documentation will be released soon.

jgiszczak avatar Sep 17 '18 22:09 jgiszczak

got the same issue...

0xtresser avatar Nov 16 '18 02:11 0xtresser