Basic EOS Programming - Discussion

Welcome to the discussion thread about this lecture section. Here you can feel free to discuss the topic at hand and ask questions.

I keep getting the errors below. Someone please help.

8 errors generated.
Error while processing /tmp/projects/5db7ea85efa97e003e055dab/src/helloworld.cpp.
abigen error
Warning, empty ricardian clause file
Warning, empty ricardian clause file
Warning, action does not have a ricardian contract

What’s the error in the red popup?

Hi mawa I have a similar issue . will post mine in the discussion.
in the meantime . did you manage to sort it out ?

JJ.

Hi Guys,

this is the error I have on the redbox.
Any help is welcome :wink:
thanks.

/project/src/helloworld.cpp:3:20: error: out-of-line definition of ‘hi’ does not match any declaration in ‘helloworld’
ACTION helloworld::hi(name user){

1 error generated.

Error while processing /project/src/helloworld.cpp.
abigen error
Warning, empty ricardian clause file
Warning, empty ricardian clause file
Warning, action does not have a ricardian contract
Warning, action does not have a ricardian contract
Warning, action does not have a ricardian contract

I assume this happens when you compile? Can you share your code here, both the cpp and the hpp file, please :slight_smile:

Hi Filip,

this is sorted
I was using the latest EOS studio version and CDT 1.6.3 ( not 1.6.2 ) like in the course.
The file include/helloworld.hpp has changed between CDT 1.6.2 and 1.6.3.
I am using now exactly the same EOS studio as in the course

Hmm, so you had to rewrite the hpp file? I’m trying to figure out how we can avoid other students facing this issue.

UPDATE!

Watched your authority/authentication video, figured what the problem was

Great! What was the problem?

1 Like

The Sample generated file has changed since your tutorials.

It comes with the require_auth(user) by default, which was why the

given name had to be the account calling the function.

All the same, thanks for the quick response.

1 Like

Hello.
The code that generates Eos Studio has changed. It’s not the same as the code at the video.
To be compatible with the video example, copy paste the code below:

In the file helloworld.cpp

#include <helloworld.hpp>

ACTION helloworld::hi(name user) {
require_auth(user);
print("Hello, ", name{user});
}

In the file helloworld.hpp
#include <eosio/eosio.hpp>

using namespace std;
using namespace eosio;

CONTRACT helloworld : public contract {
public:
using contract::contract;

 ACTION hi(name user);

 private:
TABLE messages {
         name    user;
         string  text;
         auto primary_key() const { return user.value; }
};
typedef multi_index<name("messages"), messages> messages_table;

};

Hope I helped.

For the course: Hello World - Step by Step Walkthrough
The strange command:

helloworld(name receiver, name code, datastream<const char>ds):contract(receiver,code, ds)
{}

now is not required.

1 Like

Is that the case even if you select the same eos cdt version as I had?

Yes.
I’m using cdt version 1.6.2 WEB studio.

1 Like

@filip Each time I build and run in EOS Studio, on the next screen after clicking play the console: is blank each time. :nerd_face:

@filip my helloworld.cpp looks like:

#include <hello.hpp>
#include <eosio/eosio.hpp>

ACTION hello::hi(name from, string message) {
  require_auth(from);

  // Init the _message table
  messages_table _messages(get_self(), get_self().value);

  // Find the record from _messages table
  auto msg_itr = _messages.find(from.value);
  if (msg_itr == _messages.end()) {
    // Create a message record if it does not exist
    _messages.emplace(from, [&](auto& msg) {
      msg.user = from;
      msg.text = message;
    });
  } else {
    // Modify a message record if it exists
    _messages.modify(msg_itr, from, [&](auto& msg) {
      msg.text = message;
    });
  }
}

ACTION hello::clear() {
  require_auth(get_self());

  messages_table _messages(get_self(), get_self().value);

  // Delete all records in _messages table
  auto msg_itr = _messages.begin();
  while (msg_itr != _messages.end()) {
    msg_itr = _messages.erase(msg_itr);
  }
}

EOSIO_DISPATCH(hello, (hi)(clear))

Hi
Is this causing the blank page you mention in your earlier post?
Ivo

No, after I created transaction and am on the “Transaction Details”, the console: is empty. It should be console: Hello Sonja


Hi,

I got it working now :slight_smile: