Problems with EOS Studio

Yeah, so if the contract is empty, it compiles, so the problem is not the compiler, I still think that you should build the basic structure of a contract, just add 1 function that returns ‘hello world’ (you can also use the template that is created by EOS Studio).

IF you succeed to compile a fresh contract, there is a problem with the syntax of your contract, I advice to follow the same process, with your same contract, just leave it with 1 function, if it compiles, add more functionality and compile again, and so on.

The problem could be in a bad declaration that we are not seeing, thats why the best way to debug the error, is just to test all the functions until one trigger the error.

Carlos Z

1 Like

The problem I’m having with the helloworld template that EOS Studio generates is I’ll get a compile error about not being able to find the .hpp file. I tried just adding include/hellotest.hpp to the end of the compile statement, but that didn’t work. I don’t see any examples of compile lines online that include a reference to the header file. I either need to be able to do that or I need to simplify the code or add a reference to something already in eosio like dogcontract did with #include <eosio/eosio.hpp> and #include <eosio/asset.hpp> so it doesn’t need a custom header file. If I try to simplify the code, the problem is so many things in there trigger compile errors that indicate it doesn’t recognize these things, so it would be hard to know what to eliminate and still end up with code that makes sense.

1 Like

Are you sure you install the “system contracts” from the EOS Studio setup process?

The helloworld template also create the header file (in the include folder). So when you run the compiler for the .cpp file (which include helloworld.hpp) it should load the header file, there is no need to specify to the compiler where is the header file, cuz the .cpp already mention it.

Carlos Z

OK, I’m back. Hope all is well with you. I’m working to reconnect with where I was at. Starting at re-creating a basic auto-generated contract, I am back to the problem with the .hpp file even though it is clearly referenced in the cpp file. Here’s how it looks:

ted@ted-VirtualBox:~/EOS Studio/hellotest2$ eosio-cpp -abigen -o hellotest2.wasm src/hellotest2.cpp
/home/ted/EOS Studio/hellotest2/src/hellotest2.cpp:1:10: fatal error:
‘hellotest2.hpp’ file not found
#include <hellotest2.hpp>
^~~~~~~~~~~~~~~~
1 error generated.
Error while processing /home/ted/EOS Studio/hellotest2/src/hellotest2.cpp.
abigen error

try with #include <./hellotest2.hpp> or #include "hellotest2.hpp". :face_with_monocle:

Carlos Z

Yeah, not quite. Same errors for those references. I’d send you the code, etc., but I literally changed nothing but the #include to your two suggestions, and before that it was all 100% standardized. Not sure where to go.

Would be great if you can post your code (i know it can be the same but still lets try the same that you have)

Carlos Z

This should be everything:

Ubuntu v 18.04
eosio-cpp -abigen -o hellotest2.wasm src/hellotest2.cpp

#include <eosio/eosio.hpp>

using namespace std;
using namespace eosio;

CONTRACT hellotest2 : public contract {
  public:
    using contract::contract;

    ACTION hi(name from, string message);
    ACTION clear();

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

ACTION hellotest2::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 hellotest2::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(hellotest2, (hi)(clear))
ted@ted-VirtualBox:~/EOS Studio/hellotest2$ eosio-cpp -abigen -o hellotest2.wasm src/hellotest2.cpp
/home/ted/EOS Studio/hellotest2/src/hellotest2.cpp:1:10: fatal error: 
      'hellotest2.hpp' file not found
#include "hellotest2.hpp"
         ^~~~~~~~~~~~~~~~
1 error generated.
Error while processing /home/ted/EOS Studio/hellotest2/src/hellotest2.cpp.
abigen error
1 Like

This is weird, i just copy/paste your code, copy/paste the same command line that you are using to execute the compiler, but instead of receiving an error message, it compiles and then my entire VM just crash, tried again and same happens, so i think it could be related to the eosio cdt version (the contract provide from EOS studio is v2.0, while the EOS 201 course works with v1.7.1.

Any case if you want to finish the course I advice you to run the Dog contract that the course explain, you can also check my repo which contains 2 versions of the same contracts and a lot of tips to save you time over the course.

https://github.com/thecil/EOSCoding

Carlos Z

Ok, but we may be going in circles. I was having trouble with dogcontract and that’s why I went to create the fresh contract which is where we are now. Do I need to change my version (I don’t remember how to get to that setup screen for EOS, but I have an image of it in my May 17th post)? The May 17 post before that explains the latest problem I was having with dogcontract.

I think you might have to change the version, you could use the github repo that i made in order to get some instructions on how to setup nodeos & cleos properly (with the version needed in the course).

Carlos Z

You mentioned nodeos and cleos setup, but you said earlier that the eosio cdt version is the issue here. (v.1.7.1) This is the document I’m familiar with for EOS setup https://obsidianlabs.medium.com/eos-studio-tutorial-1-set-up-the-environment-for-eosio-development-53fe3f9cb1f, but I can’t figure out how to get back to that setup screen (below) and the document doesn’t explain how to do it once everything is installed EOS Installation Screen

1 Like

@thecil, do you know how to get back to the screen above so I can get the right version of eosio.cdt in there?

1 Like

Sorry for the delay man, you could delete the entire folder of EOS Studio and start running the installer again, also remember there is button in “Application” to reset all data from the app.
Also, in the installer try to install the latest version possible (or at least v1.7.1).

image

Carlos Z

So this relates to this thread Problems with EOS Studio. Since you recommended 1.7.1 way back then and I didn’t mention having a problem, it’s likely that’s the one I installed. How do I check?

1 Like

@thecil… did you see the above?

1 Like

@thecil, what’s going on man? Talk to me.

1 Like

Hey man, sorry i forgot to reply you back them.

Did you try to reset the app like in the screenshot that i sent you?

If still not working, you could delete the EOS Studio folder and should restart the entire app.

Carlos Z

Quick question: why do we type ./nodeos_start from the contracts folder when nodeos_start is already in that folder?

So as far as clearing the app data. That didn’t seem to make any difference, so I deleted the EOS Studio folder and started the app again. Here’s the screen I get, so I still need to uninstall EOSIO.CDT before I can attempt to install v1.7.1. How do I do that?
EOS Setup

./nodeos_start is a script that i created to start the node, instead writing the big command line manually every time, you can just call that script and will start it for you, thats its purpose :nerd_face:

Might be that EOS Studio will not work anymore with old versions, you could try install the v1.9.2 and check if its run properly.

Still, keep in mind that EOS Studio is failing too much over the last year, if you want to move on with the course quickly, you can learn how to compile, deploy and interact with your contracts using Nodeos and Cleos, which are explained in the EOS Programming 201 course.

From my experience, i stopped using EOS Studio for the same reason, there are contracts that i compiled with Nodeos and they work, while compiling the same contract with EOS Studio goes into a lot of weird bugs that are not a syntax problem of my contract, its EOS Studio that is not working properly.

Carlos Z