EOSIO / eosio-explorer

An application providing Web GUI to communicate with EOSIO blockchain in a local development environment.
MIT License
113 stars 47 forks source link

Cannot deploy contract with a header file. #109

Closed peterokwara closed 5 years ago

peterokwara commented 5 years ago

I am unable to deploy a contract which has an added header file in this.

An example of this is depoying the eosio.token contract whose .cpp file requires a .hpp file (#include <eosio.token/eosio.token.hpp>)

Any way around this?

jcardenas9x commented 5 years ago

Hey; glad you used the tool. I assume you have resolved the issue by yourself or that you have closed this issue with help from someone else. However, in case you want extra clarification on this particular issue (or for others who are experiencing similar confusion), there is a way to deploy contracts requiring other .cpp or .hpp files.

Using the guide as a reference point, it is possible to bundle dependencies for your main .cpp file by organizing the folder accordingly. In the screenshot on that page, you can see that the .cpp file has the line #include "helpers/Characters.hpp, pointing to the ./helpers/Characters.hpp file in the Root Folder Path (so, the helpers folder has to be a sub-directory in the root folder path).

If you want to use #include <eosio.token/eosio.token.hpp> as an example, you would have to rewrite it as #include "eosio.token/eosio.token.hpp" and ensure that the eosio.token folder is a sub-directory of your working project folder.

I hope this is clearer for you and helps you to understand how to develop more complex smart contracts using the tool.

peterokwara commented 5 years ago

Thanks, what you have explained is what I did to make it run.

By changing the location of the header file to Screenshot from 2019-05-29 13-03-17

and changing the #include of the cpp file to Screenshot from 2019-05-29 13-04-01

I was able to point to the cpp file to the /src folder and was able to compile and upload the smart contract