This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1089 from EOSIO/docs/1.8.x-how-tos_new-template
[docs] 1.8.x - updates to match newest how to template
- Loading branch information
Showing
23 changed files
with
442 additions
and
213 deletions.
There are no files selected for viewing
62 changes: 45 additions & 17 deletions
62
docs/06_how-to-guides/10_compile/01_compile-a-contract-via-cli.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,48 @@ | ||
--- | ||
content_title: How to compile a contract via CLI | ||
content_title: How to compile a smart contract via CLI | ||
--- | ||
|
||
## Preconditions | ||
- You have the source of your contract saved in one of your local folders, e.g. `./examples/hello` | ||
For details on how to create your first contract follow [this tutorial here](https://developers.eos.io/eosio-home/docs/your-first-contract) | ||
|
||
Follow these steps to compile your contract: | ||
|
||
1. Navigate to the hello folder in examples (./examples/hello), you should then see the ./src/hello.cpp file | ||
2. Now run following commands: | ||
```sh | ||
$ mkdir build | ||
$ cd build | ||
$ eosio-cpp -abigen ../src/hello.cpp -o hello.wasm -I ../include/ | ||
``` | ||
3. This will generate two files: | ||
- The compiled binary wasm, hello.wasm | ||
- The generated ABI file, hello.abi | ||
## Overview | ||
|
||
This guide provides instructions how to compile a smart contract using the command line interface (CLI). | ||
|
||
## Reference | ||
|
||
See the following code reference: | ||
|
||
* The [`eosio-cpp`](https://developers.eos.io/manuals/eosio.cdt/latest/command-reference/eosio-cpp) tool. | ||
|
||
## Before you begin | ||
|
||
* 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](https://developers.eos.io/welcome/latest/smart-contract-guides/hello-world) guide. | ||
|
||
## Procedure | ||
|
||
Follow the following steps to compile your contract. | ||
|
||
1. Navigate to the hello folder in examples `./examples/hello`. You should see the `./src/hello.cpp` file. | ||
|
||
2. Run the following commands: | ||
|
||
```sh | ||
mkdir build | ||
cd build | ||
eosio-cpp -abigen ../src/hello.cpp -o hello.wasm -I ../include/ | ||
``` | ||
|
||
Where: | ||
- `eosio-cpp` = Is the [`eosio-cpp`](https://developers.eos.io/manuals/eosio.cdt/latest/command-reference/eosio-cpp) tool. | ||
- `-abigen` = It instructs the `eosio-cpp` tool to generate ABI file. | ||
- `../src/hello.cpp` = Is the input cpp source file to be compiled. | ||
- `-o hello.wasm` = It instructs the `eosio-cpp` tool who to name the output wasm file. | ||
- `-I ../include/` = It tells `eosio-cpp` tool what the include folder path is, in this particular case it is relative path. | ||
|
||
3. Verify the following two files were generated: | ||
|
||
* the compiled binary wasm: `hello.wasm`, | ||
* and the generated ABI file: `hello.abi`. | ||
|
||
## Summary | ||
|
||
In conclusion, the above instructions show how to compile a smart contract using the command line interface (CLI). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.