Until eosio.cdt v1.6
You could use:
From eosio.cdt v1.6 onwards
You have to #include <eosio/system.hpp> and then you can use:
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-...
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.
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
When you're generating your ABI consider a few things:
Use the new command eosio-cpp
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" ...
You could use of the newest macros:
Added ACTION macro which is simply a shortcut for [[eosio::action]]
Added TABLE macro which is simply a shortcut for struct
Added CONTRACT macro which is simply a shortcut for
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.
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....
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.
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....
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 ...
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. ...
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.