This guide provides instructions how to compile a smart contract using the command line interface (CLI).
See the following code reference:
- You have the source of the contract saved in a local folder, e.g.
./examples/hello/For details on how to create your first contract follow the Hello World Contract guide.
Follow the following steps to compile your contract.
- Navigate to the hello folder in examples
./examples/hello. You should see the
Run the following commands:
mkdir build cd build eosio-cpp -abigen ../src/hello.cpp -o hello.wasm -I ../include/
eosio-cpp= Is the
-abigen= It instructs the
eosio-cpptool to generate ABI file.
../src/hello.cpp= Is the input cpp source file to be compiled.
-o hello.wasm= It instructs the
eosio-cpptool who to name the output wasm file.
-I ../include/= It tells
eosio-cpptool what the include folder path is, in this particular case it is relative path.
- Verify the following two files were generated:
- the compiled binary wasm:
- and the generated ABI file:
In conclusion, the above instructions show how to compile a smart contract using the command line interface (CLI).