I have created smart contract inside the /build/contracts and running this comman generates empty abi file.
eosiocpp -g eosio.test.abi eosio.test.cpp
tried both hpp and cpp but same result.
When you're generating your ABI consider a few things:
Use the new command eosio-cpp
For example: eosio-cpp -I include -o my_contract.wasm my_contract.cpp -abigen
Use the C++ 11 attributes included in the newest EOSIO version such as [[eosio::action]], [[eosio::table]], [[eosio::contract]]
you need extra comments marked in hpp file to help eosiocpp generate concrete abi file. for actions, you need to add comment
above its declaration. for multi_index table, you need to add comment
//@abi table <underlying class or struct name> (i64|i32)
above the underlying class or struct definition.
You could use of the newest macros:
Added ACTION macro which is simply a shortcut for [[eosio::action]] void.
Added TABLE macro which is simply a shortcut for struct [[eosio::table]].
Added CONTRACT macro which is simply a shortcut for class [[eosio::contract]].
I'm assuming you are using one of the new CDTs
In my case the following command worked
eosio-abigen hello.cpp --contract=hello --output=hello.abi
I had this happen to me last night. Make sure the class name and your file names match.
In other words, if you're compiling the hello contract, make sure the file names are