eos icon indicating copy to clipboard operation
eos copied to clipboard

abi_generation_exception: Unable to generate abi

Open OuterSpaceTears opened this issue 8 years ago • 2 comments

I made a mistake when I generated ABI file through eosiocpp -g. common log: ` feng@feng-B250-HD3P:~/workSpace/eos/build/contracts/tic_tac_toe$ eosiocpp -g tic_tac_toe.abi tic_tac_toe.cpp 1599666ms thread-0 main.cpp:68 main ] 999999 abi_generation_exception: Unable to generate abi false: types can only be: vector, struct, class or a built-in type. (uint8_t [9]) {"type":"uint8_t [9]"} thread-0 abi_generator.cpp:562 add_type {} thread-0 abi_generator.cpp:246 handle_decl

{"decl_location":"/home/feng/workSpace/eos/build/contracts/tic_tac_toe/tic_tac_toe.cpp:10:12 <Spelling=/home/feng/workSpace/eos/build/contracts/tic_tac_toe/tic_tac_toe.cpp:10:19>"}
thread-0  abi_generator.cpp:34 handle_tagdecl_definition

1599666ms thread-0 main.cpp:68 main ] output: {"types":[],"structs":[],"actions":[],"tables":[]} `

tic_tac_toe.cpp ` #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> using namespace eosio;

class tic_tac_toe : public eosio::contract { public:

 //@abi table game i64

struct PACKED(game) {

    game() {};
    //@abi table game i64
    game(account_name challenger, account_name host):challenger(challenger), host(host), turn(host) {
      //Initialize board
      initialize_board();
    };
    account_name     challenger; // this also acts as key of the table
    account_name     host;
    account_name     turn; // = account name of host/ challenger
    account_name     winner = N(none); // = none/ draw/ account name of host/ challenger
    uint8_t          board_len = 9;
    uint8_t          board[9]; //
    
    //Initialize board with empty cell
    void initialize_board() {
      // for (uint8_t i = 0; i < board_len ; i++) {
      //   board[i] = 0;
      // }
    }

    // Reset game
    void reset_game() {
      initialize_board();
      turn = host;
      winner = N(none);
    }
};


//@abi action
struct create {
    account_name   challenger;
    account_name   host;
};

//@abi action
struct restart {
    account_name   challenger;
    account_name   host;
    account_name   by; // the account who wants to restart the game
};

//@abi action
struct close {
    account_name   challenger;
    account_name   host;
};


struct movement {
    uint32_t    row;
    uint32_t    column;
};

//@abi action
struct move {
    account_name   challenger;
    account_name   host;
    account_name   by; // the account who wants to make the move
    movement       mvt;

    EOSLIB_SERIALIZE( move, (challenger)(host)(by)(mvt) )
};

};

//EOSIO_ABI( hello, (hi) ) ` Does @abi table don't support arrays now,What should I do? @elmato

OuterSpaceTears avatar Apr 03 '18 10:04 OuterSpaceTears

@heifner

OuterSpaceTears avatar Apr 04 '18 03:04 OuterSpaceTears

@OuterSpaceTears do you have any solution on this?

giniz avatar Apr 20 '18 07:04 giniz