I try to create two tables and mult_index, I received an error on output.
header file
#include <eosio/eosio.hpp>
#include <eosio/asset.hpp>
using namespace eosio;
CONTRACT game : public contract
{
public:
using contract::contract;
game(name receiver, name code, datastream<const char *> ds)
: contract(receiver, code, ds), config(receiver, receiver.value) {}
ACTION setconf(uint64_t config_id, uint32_t init_energy, uint32_t init_max_energy, uint64_t last_fee_updated, uint8_t fee);
ACTION newuser(name owner);
TABLE config_table
{
uint64_t config_id;
uint32_t init_energy;
uint32_t init_max_energy;
uint64_t last_fee_updated;
uint8_t fee;
uint64_t primary_key() const { return config_id; }
};
TABLE accounts_table
{
name account;
uint32_t energy;
uint32_t max_energy;
asset balances;
name primary_key() const { return account; }
};
typedef multi_index<name("config"), config_table> config_index;
typedef multi_index<name("accounts"), accounts_table> accounts_index;
using setconf_action = action_wrapper<name("setconf"), &game::setconf>;
using newuser_action = action_wrapper<name("newuser"), &game::newuser>;
config_index config;
accounts_index accounts;
};
error output:
[ 50%] Building CXX object CMakeFiles/game.dir/game.obj
In file included from /wax/mycontract/game/src/game.cpp:1:
/wax/mycontract/game/src/../include/game.hpp:11:4: error: constructor for 'game' must explicitly initialize the member 'accounts' which does not have a default constructor
game(name receiver, name code, datastream<const char *> ds)
^
/wax/mycontract/game/src/../include/game.hpp:43:19: note: member is declared here
accounts_index accounts;
^
/usr/local/eosio.cdt/bin/../include/eosiolib/contracts/eosio/multi_index.hpp:431:7: note: 'eosio::multi_index<3607749779137757184, game::accounts_table>' declared here
class multi_index