Eos: print implementation for std::string

Created on 12 May 2018  ·  3Comments  ·  Source: EOSIO/eos

If I try to print variable of type std::string I get this compile time error:

In file included from /usr/local/include/eosiolib/vector.hpp:2:
In file included from /usr/local/include/eosiolib/memory.hpp:8:
/usr/local/include/eosiolib/print.hpp:153:9: error: no member named 'print' in 'std::__1::basic_string<char>'
      t.print();
      ~ ^
/usr/local/include/eosiolib/print.hpp:216:7: note: in instantiation of function template specialization 'eosio::print<const std::__1::basic_string<char> &>' requested here
      print(std::forward<Arg>(a));
      ^
/home/tadas/Programming/Projects/eos-contracts/timeos/timeos.cpp:21:17: note: in instantiation of function template specialization 'eosio::print<const std::__1::basic_string<char> &, char const (&)[2]>' requested here
         eosio::print(it->data, " ");
                ^
5 warnings and 1 error generated.

Most helpful comment

After updating to the eosio.cdt binary for 1.4.0 this error is back. Ubuntu 18.04.1 LTS. Going to try compiling the source to see if the error persists.

All 3 comments

Fixed via Dan's referenced commit.

After updating to the eosio.cdt binary for 1.4.0 this error is back. Ubuntu 18.04.1 LTS. Going to try compiling the source to see if the error persists.

After updating to the eosio.cdt binary for 1.4.0 this error is back. Ubuntu 18.04.1 LTS. Going to try compiling the source to see if the error persists.

use const std::string not std::string as arguments.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dexaran picture Dexaran  ·  3Comments

Npizza picture Npizza  ·  3Comments

jiazechen picture jiazechen  ·  3Comments

bezalel picture bezalel  ·  3Comments

IvanYakimov picture IvanYakimov  ·  3Comments