2

I'm on a Mac, and working through the Hello World contract.

I managed to create the Hello.cpp file using the touch command in Terminal... but how do I find this file, and/or how do I edit it?

2
  • touch creates an empty file wherever you specify in the argument. you edit it with a text editor, but it'll be empty
    – confused00
    Aug 14, 2018 at 21:00
  • I would like to edit it, but I don't know where the file is located on my Mac. I'm also using Docker to access cleos.
    – Ben
    Aug 14, 2018 at 23:28

2 Answers 2

3

Open terminal and go to your home directory because it is the root directory of your all work directories . Go through this sequence

1.open terminal
2.# cd 
3.#locate hello.cpp

and you will find your file . now open your file like this using vim like this

vim hello.cpp

press i (to edit your file ) after editing press Esc than Ctrl+Shift+: and press wq (to save your file ) this will work if you have vim install to your system .

0

It is recommended to use eosiocpp for the purpose of initiating your contract.

Just run:

eosiocpp -n hello

Then:

cd hello && ls

And you will see two files hello.cpp and hello.hpp.

This is the good way to start writing your contract from scratch.

3
  • eosiocpp is deprecated in latest version
    – confused00
    Aug 14, 2018 at 21:00
  • @confused00 thank you for pointing this out. Did they move this functionality to another component? Aug 14, 2018 at 21:03
  • 1
    eosio-cpp should be the replacement (see todd fleming's telegram posts) but haven't checked yet if they still have the -n flag
    – confused00
    Aug 14, 2018 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.