9

Until eosio.cdt v1.6 You could use: eosio::current_time() now() From eosio.cdt v1.6 onwards You have to #include <eosio/system.hpp> and then you can use: eosio::current_time_point eosio::current_block_time


3

cmake will compile source files into object files first and link them by linker, so you need to add -stack-size option to linker option. (When you run eosio-cpp in command-line, passing -stack-size to compile options is allowed, because eosio-cpp will pass linker options to eosio-ld) add_contract(test test test.cpp) target_link_options(test PUBLIC -stack-...


3

Problem solved ! I didn't go through the CHANGELOG for the latest 1.2 to 1.3 upgrade. It turns out, the EOSIO_ABI macro has been renamed EOSIO_DISPATCH and so, it seems there is no problem with compilation on my machine. One thing is remaining, but is linked to ABI generation, for which I took the decision to write it manually.


3

The problem here was that the path provided was relative, and Rohan was working with a docker container. When passing the path to your contract's directory when using docker, it should be an absolute path, and match the mounted path of your docker container. cleos set contract helocode1234 /contracts/hello helo.wasm helo.abi -p helocode1234@active The ...


3

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 hello.hpp and hello.cpp.


2

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


2

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]] If the contract structure is too complicated at this point "abigen" ...


2

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]].


2

I needed to add read write permission to the eosio-cpp folder for non-sudo access. $ sudo chmod 755 /usr/local/eosio.cdt/bin/eosio-cpp and that solved it.


2

Well, what I learnt from EOS developers Telegram group: Update eosio.cdt. The latest version is 1.3.2 Also, although the tutorial says not to use abigen since abi is included...we need to use abigen since eosio.token.abi is not included in the download. So the command need to be changed as below: eosio-cpp -I include -o eosio.token.wasm src/eosio.token....


2

With eosiocpp everything works fine because types.hpp is defined in the directory ...\eos\contracts\eosiolib. In eosio.cdt in ...\eosio.cdt\libraries\eosiolib there is only types.h and not types.hpp and so types.hpp cannot be found.


1

If you want to build a single contract with eosio.cdt you would need to modify the code. Just use the build-script build.sh (located in the eosio.contracts-directory) to compile all system-contracts at once, without the need to modify any of them.


1

You need to download the hpp & cpp files: $ wget https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/eosio.token/include/eosio.token/eosio.token.hpp $ wget https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/eosio.token/src/eosio.token.cpp Next, change import statement: $ vim eosio.token.cpp change line 6: include "eosio.token....


1

To use this syntax, you need to be compiling with the latest version of eosio.cdt. When you build and compile eosio.cdt, it will install the appropriate clang compiler for you, and eosio-cpp will be called with all of the appropriate flags. Also, in your particular case, your attributes are missing a colon, it should say [[eosio::action]], not [[eosio:...


1

Multiple inheritance not supported for this particular case means that you can only have a tuple of single type. typedef std::tuple<double> location_t; According to this answer one is not able to use tuple. Can somebody also confirm that this is the case? Just replaced tuple with struct to avoid this headache. It's weird that tuple is used ...


1

The eosiocpp compiler was the old deprecated way of compiling the c++ into wasm contracts. The new way uses a compiler called eosio-cpp, which is very confusing. With eosio.cdt, you can generate a CMake build system using eosio-init, and it will generate the cmake command target_ricardian_directory, where you should specify your ricardian contract files. ...


1

you need extra comments marked in hpp file to help eosiocpp generate concrete abi file. for actions, you need to add comment c++ //@abi action above its declaration. for multi_index table, you need to add comment c++ //@abi table <underlying class or struct name> (i64|i32) above the underlying class or struct definition.


Only top voted, non community-wiki answers of a minimum length are eligible