EOS.IO Asked by Vishal Singh on August 20, 2021
I am trying to use this :
struct [[eosio::table]] tokens {
name token;
std::map<name,asset> blnc;
uint64_t primary_key() const { return token.value; }
};
But I get the following error :
error: error reading ‘/home/ubuntu/exchange.cpp’ 1 error generated.
Error while processing /home/ubuntu/exchange.cpp. abigen error
Is there a problem with using maps in tables in eosio-cpp
?
I have used maps in a table without issue before, my table looks like this:
class [[ eosio::table("ram"), eosio::contract("automatedres") ]] ram_t
{
private:
eosio::time_point created;
public:
std::map< eosio::name, int64_t > ram_usage;
std::map< eosio::name, bool > paid_chex; ///@todo Create modifier and accessor functions
uint64_t primary_key() const { return created.sec_since_epoch(); }
auto set_created(eosio::time_point const &x) { created = x; }
auto get_created() const { return created; }
};
typedef eosio::multi_index< eosio::name("ram"), ram_t > ram_table;
If this doesn't work for you, then perhaps you are using an older version of the eosio.cdt
or something. Upgrade to the latest version of the software and check again.
Answered by Phillip Hamnett - EOS42 on August 20, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP