EOS Hello World Discussion

What is the error you are getting?

command cleos not found

use this and it works
export PATH=$PATH:/usr/local/eosio/bin/

everything seems to be working alright for me now, just trying to learn more about the smart contract i want to write.

1 Like

Great! Good job at finding the solution :slight_smile:

My code is exacly like yours but
I am getting all the time that error:192:hello user$ eosio-cpp -o hello.wasm hello.cpp --abigen
hello.cpp:30:11: error: unknown type name ā€˜account_nameā€™
void hi(account_name user){
^
hello.cpp:34:19: error: C++ requires a type specifier for all declarations
EOSIO_ABI(hello, (hi))
^
hello.cpp:34:23: error: expected function body after function declarator
EOSIO_ABI(hello, (hi))
^
3 errors generated.
192:hello user$

Haha, looks like eos already released a new version of the build tools. Just 4 days ago. I will have to update the video again.

In the mean time you can fix the issue by checking out the git tag v1.2.1 and re-installing the build tools. I will update the video in just 1 hour or so.

The video and the install command is updated now. Sorry about that. Eos moves so quickly.

it says that i should use command git checkout v1.2.1 but i got now this message:
192:eosio.cdt user$ git checkout v1.2.1
M eosio_llvm
M libraries/libc++/libcxx
M libraries/libc/musl
Note: checking out ā€˜v1.2.1ā€™.

You are in ā€˜detached HEADā€™ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at 112df8dā€¦ Merge pull request #89 from EOSIO/release/1.2.x
192:eosio.cdt user$ cd

and then i deleted eosio.cdt, `i intalled it again from command from updated video and got the same errors

1.2.1 is the latest according to https://developers.eos.io/eosio-home/docs/installing-the-contract-development-toolkit isnā€™t it?

Yes, I mixed them up. The message you get is normal and not an error.

But either way, no you donā€™t need to do git checkout at all. Just follow the new video. You donā€™t need to do anything else.

How to find out what name I gave to my account?

If itā€™s on mainnet you can use https://eosauthority.com/.

Locally Iā€™m not sure. Easiest is probably to just create a new one.

Hi Filip, I am a bit stuck on the cpp compilation portion. after typing ā€œeosio-cpp -o hello.wasm hello.cpp --abigenā€, my terminal just gets stuck there. I think it is taking a very long time to compile. and if I stop the process using ctrl + c, when i look at the list (ls) it does not reflect the ABI either.

As the terminal was compiling, I opened another tab to look into the eos/contracts/hello directory, and I see a hello.wasm.temp8317aa4. Not too sure what this is

Can you share the code of you hello.cpp file?

Hi Filip,
I have the same issue as apeondrums here is my hello.cpp code:

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace eosio;

class hello : public eosio::contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( account_name user ) {
         print( "Hello, ", name{user} );
      }
};

EOSIO_ABI( hello, (hi) )

Though please note that because i installed the EOSIO.CDT Version : 1.3.2 the ā€˜EOSIO_ABIā€™ was renamed to ā€˜EOSIO_DISPATCHā€™. And ā€˜account_nameā€™ was removed also and replaced by ā€˜nameā€™.

When editing thouse changes in the code i get the following errors which i couldnā€™t overcome:

hello.cpp:15:25: error: C++ requires a type specifier for all declarations
EOSIO_DISPATCH( hello, (hi) )
^
hello.cpp:15:30: error: expected function body after function declarator
EOSIO_DISPATCH( hello, (hi) )
^
2 errors generated.

can you please advice?
Thanks

If you are using the 1.3.2 version, I would try the code from the eos developer portal for that version. Which would be this. Let me know if it works.

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>

using namespace eosio;

class hello : public contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( name user ) {
         print( "Hello, ", name{user});
      }
};
EOSIO_DISPATCH( hello, (hi))

Hi Filip,
I already used that code , in my previous reply i intended to say that the deprecated code was changed to the code that you wrote above.
And this code just stuck when running.
It seems that he is stuck in creating the wasm file.
Thanks

I donā€™t understand. Which version are you running and what code are you running? If you could clarify please.

Hi,
I am using the 1.3.2 version - the latest.
and this code:

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>

using namespace eosio;

class hello : public contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( name user ) {
         print( "Hello, ", name{user});
      }
};
EOSIO_DISPATCH( hello, (hi))

And i am getting these errors:

hello.cpp:15:25: error: C++ requires a type specifier for all declarations
EOSIO_DISPATCH( hello, (hi) )
^
hello.cpp:15:30: error: expected function body after function declarator
EOSIO_DISPATCH( hello, (hi) )
^
2 errors generated.

Seems like the contract has changed. Try this. https://github.com/EOSIO/eosio.cdt/blob/master/examples/hello/hello.cpp

1 Like

Thanks filip , i have tried though without success.
These are the errors that i get when running the following compile command:

sudo eosio-cpp -o hello.wasm hello.cpp --abigen

hello.cpp:6:1: error: unknown type name 'CONTRACT'
CONTRACT hello : public eosio::contract {
^
hello.cpp:6:16: error: expected ';' after top level declarator
CONTRACT hello : public eosio::contract {
               ^
               ;
hello.cpp:6:18: error: expected unqualified-id
CONTRACT hello : public eosio::contract {
                 ^
hello.cpp:15:1: error: C++ requires a type specifier for all declarations
EOSIO_DISPATCH( hello, (hi) )
^
hello.cpp:15:25: error: use of undeclared identifier 'hi'
EOSIO_DISPATCH( hello, (hi) )
                        ^
hello.cpp:15:30: error: expected ';' after top level declarator
EOSIO_DISPATCH( hello, (hi) )
                             ^
                             ;
6 errors generated.

Though as i checked now it seems that i have
eosio-cpp version 1.2.1
eosio-abigen version 1.2.1

So i installed eosio.cdt-1.3.2.x86_64.deb
and it didnā€™t change the version of the cpp & abigen.

Maybe i will try again to build the eosio.cdt.

p.s
People run the command and itā€™s stuck. Go here itā€™s probably because you are using a VirtualBox