1

I am reproducing 'Hello World' contract from the docs. It does compile fine with eosiocpp -o hello.wast hello.cpp, but eosiocpp -g hello.abi hello.cpp produce the following error:

error: unable to handle compilation, expected exactly one compiler job in ''

Any suggestions what is wrong and how to resolve it?

1
  • i would uninstall EOSIO, pull the latest release from github, rebuild, and reinstall
    – confused00
    Jul 26, 2018 at 1:01

1 Answer 1

2

I'm not familiar with that specific error message, but what I do know is that the ABI generation feature will only work if your code is properly annotated by marking the actions and DB tables like shown in this example: https://github.com/andresberrios/token_ram_recovery/blob/master/token_ram_recovery.hpp

There you can see that the action methods have been annotated:

//@abi action
void destroytoken( string symbol );

and the DB tables are annotated like this, on the struct that represents the data type stored in the table:

//@abi table accounts i64
    struct account {
    asset    balance;
    uint64_t primary_key()const { return balance.symbol.name(); }
};

So the format for DB table annotations is //@abi table <table_name> <index_data_type>.

I think you can use this annotations on either the .hpp or the .cpp file. Without using these annotations, the automatic generation of the ABI using eosiocpp will not work properly or will generate an ABI with missing parts. You can also write the ABI file by hand, which is why in the EOSIO/eos repository you will find the ABI files already there instead of them being generated from the other source files like the WAST and WASM files are. They wrote the ABIs by hand.

3
  • Thanks for pointing that out, but is not my issue. I use official example, which use triple forward slash btw /// @abi action . I tried double forward slash, same issue. Jul 27, 2018 at 9:22
  • It shouldn't matter if it's 2 or 3 slashes. I think your problem is not related to the annotations. There is some issue with the eosiocpp bin it seems, as it should be able to easily perform that task. Did you compile eos from source or are you using the docker binaries or what exactly are you using? As @confused00 commented: "i would uninstall EOSIO, pull the latest release from github, rebuild, and reinstall" Jul 27, 2018 at 15:23
  • I compiled from sources and cleos/nodeos are working as well compiling to wasm. I'll rebuild today and let you know. Thanks anyway! Jul 27, 2018 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.