EOS Hello World Discussion


#21

What is the error you are getting?


#22

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.


#23

Great! Good job at finding the solution :slight_smile:


#24

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$


#25

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.


#26

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


#27

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


#28

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


#29

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.


#30

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


#31

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.


#32

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


#33

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


#34

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


#35

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))

#36

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


#37

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


#38

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.

#39

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


#40

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