5 votes
Accepted

Can not find <eosiolib/eosio.hpp> when compiling with eosiocpp #2

If you used sudo make install, then you should use the eosiocpp binaries generated for you. In the latest version, I believe they shoud be in /usr/local/eosio/bin/ (it should print this info when sudo ...
  • 5,524
3 votes
Accepted

How to pass specific eosio-cpp/eosio-ld options via cmake

cmake will compile source files into object files first and link them by linker, so you need to add -stack-size option to linker option. (When you run eosio-cpp in command-line, passing -stack-size to ...
  • 2,270
3 votes
Accepted

how to find greatest common divisor inside smart contract?

You should have #include <numeric> to use std::gcd in your code.
  • 2,270
3 votes

Is it possible to set up a smart contract with multiple .cpp and .hpp files?

It is possible: Set up a new smart contract environment using eosio-init: eosio-init -project=mycontract -path=. Create all of your .cpp and .hpp files as appropriate In the ./src folder, edit the ...
3 votes
Accepted

Dawn4 build error - eosio.token/eosio.token.wast.hpp: No such file or directory

I had the same error, and filed a bug (which has been assigned). A short-term fix supplied by someone, which seems to work: go into build/contracts, run make, return to top level and run the original ...
  • 654
3 votes
Accepted

static_assert failed "Types with user specified constructors (non-aggregate initializable types) are not supported

I solved the problem - the problem was caused by the fact I was not setting default constructors for each class that produced this error message. class x { // Private variables public: x(){/* ...
2 votes

Is it possible to compile a smart contract using g++ or clang?

With eosio.cdt, it is now possible to compile object code which can then be tested using unit tests. Check out https://eosio.github.io/eosio.cdt/1.5.0/guides/native-tester.html for a detailed guide. ...
2 votes
Accepted

How to correctly include multiple .cpp files in eosiocpp -o?

This is a workaround based on @KemmyGuo 's comment: You can include the additional .cpp files (which have to be in the same folder) into your contracts .cpp file. Disclaimer: this is not a good C++ ...
  • 2,104
2 votes

Importing CMake Project into Clion, Unable to find BOOST_ROOT

I think it has to do with the most recent EOSIO git repo having the boost root as ~/opt/boost and the CMake is looking for something like ~/opt/boost__1__6__6 The way I solved this is by importing ...
2 votes

What is needed to get the EOS ~1.1.4 tutorials working on Ubuntu 16.04 (having compiled from source)?

I had this as a comment, but as I work more myself, I'm realizing that this is as good as it's going to get for now, and my comment is really easy to miss... I got contracts to compile. Block.one has ...
  • 151
2 votes
Accepted

Constructor error message

You may have written several constructors for your BP class, but do you have a default constructor? All classes that are to be used as multi_index arrays require that the class has a default ...
2 votes

Can not find <eosiolib/eosio.hpp> when compiling with eosiocpp #2

This is a known issue for eosiocpp in version 1.1.2/1.1.3 of the eosio/eos Github repo. Switching to version 1.1.0 solved the problem for me and a colleague. Here's a host of issues relating to the ...
2 votes
Accepted

Is the a way to pass preprocessor macro to `eosiocpp` for specific types of compilation

Define your variables in the environment variable EOSIOCPP_CFLAGS. If you are curious, just open the eosiocpp file (it's a bash script, a wrapper over clang) to see how the variable is used.
2 votes

Why does the -abigen option in eosio.cdt not work?

The solution to my problem was that the wasm file had to exactly match the name of the contract in the attributes of the contract class. So as my file was called mycontract.wasm, I had to have the ...
2 votes
Accepted

COMPILATION ERROR error: non-type template argument is not a constant expression

"requestLoan" isn't a valid name for an EOSIO table; it only supports lower-case names using alpha characters. https://developers.eos.io/eosio-cpp/docs/naming-conventions#section-table-names-structs-...
1 vote
Accepted

Compiling smart contract not getting done

a few things to consider: it is not advisable to compile on your servers. you need tbe full blown dev environment to be set up correctly (all dependencies) in order to compile successfuly; when eosio-...
  • 371
1 vote

contract compilation of 'eosio.bios' fails

If you want to build a single contract with eosio.cdt you would need to modify the code. Just use the build-script build.sh (located in the eosio.contracts-directory) to compile all system-contracts ...
  • 1,884
1 vote

ABI file not generated

I wasn't getting an abi file, but it was compiling fine. I finally noticed that I had the file named: widgets.cpp but the class was widget. Watch out for missing "S"s. Ran again and the abi ...
  • 23
1 vote
Accepted

Issue while compiling smart contract - eosio.cdt

I have solved the issue by using below commands sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 sudo apt-get install --only-upgrade libstdc++6
  • 510
1 vote

What is an overhead of a smart-contracts compiled to WebAssembly using different languages?

Theoretically C++ is the most efficient language, since it is the native language for wasm, no one thinks of writing assembly by hand. Next are Rust and Go, these probably add some overhead since ...
  • 1,686
1 vote

Can not find <eosiolib/eosio.hpp> when compiling with eosiocpp #2

As a workaround, revert locally the commit which introduced a regression, then build and install again: cd $HOME/eos git revert -n 67393d7 ./eosio_build.sh cd build sudo make install eosiocpp should ...
1 vote

Can't use fopen, fclose, and ifstream

The EOS smart contracts do not have file system. Thus, you cannot use file system functions. Practical thinking for the homework: Where would the file reside as the code is executed on a block ...

Only top scored, non community-wiki answers of a minimum length are eligible