eosio.cdt
eosio.cdt copied to clipboard
Can not find `eosio/eosio.hpp` while compiling with eosio-cpp
I used the documentation provided by EOSI. I made all the required installation as suggested in the docs. While writing the hello world contract, I face this issue when running the following command eosio-cpp -abigen -o hello.wasm hello.cpp
. Please help. I am using Ubuntu 18.04
Machine (As I saw in some posts that this error is machine specific)
hello.cpp:1:10: fatal error: 'eosio/eosio.hpp' file not found
#include <eosio/eosio.hpp>
^~~~~~~~~~~~~~~~~
1 error generated.
Can you provide which version of eosio-cpp
you are currently using?
Example:
~ $ eosio-cpp --version
eosio-cpp version 1.6.1
Also, what is in your /usr/local/eosio.cdt/include/eosiolib/contracts/eosio/
directory?
Example:
/usr/local/eosio.cdt/include/eosiolib/contracts/eosio $ ls
action.hpp dispatcher.hpp multi_index.hpp privileged.hpp singleton.hpp transaction.hpp
contract.hpp eosio.hpp permission.hpp producer_schedule.hpp system.hpp
I've just upgraded to 1.6.1 from 1.5.0 and now can't compile anything. on OSX the directory you refer to is /usr/local/Cellar/eosio.cdt/1.6.1/opt/eosio.cdt/include/eosiolib/contracts/eosio/
and mine contains:
-rw-r--r-- 1 ekkis staff 21043 Mar 22 16:03 action.hpp
-rw-r--r-- 1 ekkis staff 2672 Mar 22 16:03 contract.hpp
-rw-r--r-- 1 ekkis staff 4074 Mar 22 16:03 dispatcher.hpp
-rw-r--r-- 1 ekkis staff 671 Mar 22 16:03 eosio.hpp
-rw-r--r-- 1 ekkis staff 85064 Mar 22 16:03 multi_index.hpp
-rw-r--r-- 1 ekkis staff 9326 Mar 22 16:03 permission.hpp
-rw-r--r-- 1 ekkis staff 9040 Mar 22 16:03 privileged.hpp
-rw-r--r-- 1 ekkis staff 1837 Mar 22 16:03 producer_schedule.hpp
-rw-r--r-- 1 ekkis staff 4161 Mar 22 16:03 singleton.hpp
-rw-r--r-- 1 ekkis staff 1427 Mar 22 16:03 system.hpp
-rw-r--r-- 1 ekkis staff 10273 Mar 22 16:03 transaction.hpp
but I'm also getting all these other errors:
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "token.cpp"
No compilation database found in /Users/ekkis/dev or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
In file included from /Users/ekkis/dev/token.cpp:1:
/Users/ekkis/dev/token.hpp:3:10: fatal error: 'string' file not found
#include <string>
^~~~~~~~
1 error generated.
Error while processing /Users/ekkis/dev/token.cpp.
abigen error
there is no guidance on the release notes about initialising databases nor have I been able to find info by googling the errors. any help would be much appreciated
eosio-cpp still fails (CDT 1.7.0) with the same error reported by the OP in some situations like when -E (Only run the preprocessor) is used/specified. e.g. Is not possible to use Makefile targets ended in .i. Even when using eosio-cpp by hand, with all the include directories specified, the error appears:
CDT installation (binaries and source code)
$ wget https://github.com/eosio/eosio.cdt/releases/download/v1.7.0/eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb
$ sudo apt install ./eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb
$ git clone https://github.com/EOSIO/eosio.cdt.git
$ cd eosio.cdt
$ git checkout v1.7.0
Example 1: Using the generated Makefile
$ cd eosio.cdt/examples/hello/
$ mkdir build
$ cd build
$ cmake ..
$ make # << This works Ok, but the following doesn't
$ cd tests
$ make hello_test.i
eosio.cdt/examples/hello/tests/hello_test.cpp:1:10: fatal error: 'eosio/eosio.hpp' file not found
#include <eosio/eosio.hpp>
^~~~~~~~~~~~~~~~~
1 error generated.
Error while processing eosio.cdt/examples/hello/tests/hello_test.cpp.
abigen error
CMakeFiles/hello_test.dir/build.make:66: recipe for target 'CMakeFiles/hello_test.dir/hello_test.cpp.i' failed
make[1]: *** [CMakeFiles/hello_test.dir/hello_test.cpp.i] Error 255
make[1]: *** Deleting file 'CMakeFiles/hello_test.dir/hello_test.cpp.i'
Makefile:141: recipe for target 'hello_test.cpp.i' failed
make: *** [hello_test.cpp.i] Error 2
Example 2: Manual usage
$ cd eosio.cdt/examples/hello/tests
$ eosio-cpp -E \
-I /usr/opt/eosio.cdt/1.7.0/include/eosiolib/contracts/ \
-I /usr/opt/eosio.cdt/1.7.0/include/eosiolib/native/ \
-I /usr/opt/eosio.cdt/1.7.0/include/eosiolib/capi/ \
-I /usr/opt/eosio.cdt/1.7.0/include/eosiolib/core/ \
-I ../include \
hello_test.cpp
eosio.cdt/examples/hello/tests/hello_test.cpp:1:10: fatal error: 'eosio/eosio.hpp' file not found
#include <eosio/eosio.hpp>
^~~~~~~~~~~~~~~~~
Warning, empty ricardian clause file
Warning, empty ricardian clause file
1 error generated.
Error while processing eosio.cdt/examples/hello/tests/hello_test.cpp.
abigen error
Hi,
I am trying to complete the EOSIO tutorial for helloworld on Ubuntu 20.04 and I keep getting an error when trying to compile because I cannot #include the eosio.hpp file.
I don't think this issue has been resolved, can someone help me?
I am trying to complete the EOSIO tutorial for helloworld
why are you even trying to build on EOS? I've abandoned it as it offers zero support to developers
@ekkis just trying to learn, might eventually develop for Telos which runs EOS.io
any help on the question though? why can't my compiler locate the eosio.hpp?
try:
#include <eosio/eosio.hpp>
but seriously... don't waste your time. build on Polkadot or Cosmos or something that isn't a badly managed island
Hi,
I am trying to complete the EOSIO tutorial for helloworld on Ubuntu 20.04 and I keep getting an error when trying to compile because I cannot #include the eosio.hpp file.
I don't think this issue has been resolved, can someone help me?
I don't know how are you trying to compile or install EOS blockchain or CDT. If you don't want to deal with that, you can use my development docker which includes a blockchain node (v2.0.6) as well as CDT (v1.7.0). The OP's example (https://developers.eos.io/eosio-home/docs/your-first-contract) works OK with it. The docker also includes tools like Vim and Midnight Commander.
In order to start with coding, first install docker, and 2nd do the following in a terminal:
$ docker run -it jalbiero/eosdev bash
After that, follow the given instructions in the aforementioned example.
If you want to know how to compile/install EOS and CDT you can see the docker build project here: https://github.com/jalbiero/eos-dev-docker
I will be updating the docker image soon with the latest versions of EOS and CDT.
I will be updating the docker image soon with the latest versions of EOS and CDT.
FYI:
I updated the docker image to EOS 2.0.10: https://hub.docker.com/r/jalbiero/eosdev
I also added some examples that show how to use the docker: https://github.com/jalbiero/eos-dev-docker/tree/master/samples
I am trying to complete the EOSIO tutorial for helloworld on Ubuntu 20.04 and I keep getting an error when trying to compile because I cannot #include the eosio.hpp file.
@wfalcon3 One thing that I forgot to mention: Current official releases (2.0.x) don't support Ubuntu 20.04. You have to wait for EOS 2.1.x (currently 2.1.0-rc3).