简体   繁体   English

致命错误:找不到“boost/uuid/uuid.hpp”文件

[英]fatal error: 'boost/uuid/uuid.hpp' file not found

I am trying to include boost UUID libraries in EOS smart contract .我正在尝试在EOS智能合约中包含boost UUID 库。

#include <string>
#include <eosio/crypto.hpp>
#include <boost/uuid/uuid.hpp>

I followed this link to install boost just changed the version to 1.73.0: http://janisz.github.io/2013/11/27/install-boost-on-ubuntu/我按照这个链接安装boost只是将版本更改为1.73.0: http://janisz.github.io/2013/11/27/install-boost-on-ubuntu/

List of commands I executed are:我执行的命令列表是:

sudo apt-get update
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
cd /tmp
wget http://downloads.sourceforge.net/project/boost/boost/1.73.0/boost_1_73_0.tar.gz
tar -zxvf boost_1_73_0.tar.gz
cd boost_1_73_0
./bootstrap.sh --prefix=/usr/local
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
echo "Available CPU cores: "$cpuCores
sudo ./b2 --with=all -j $cpuCores install

After this:在这之后:

./bootstrap.sh --prefix=/usr && ./b2 stage threading=multi link=shared
./b2 install threading=multi link=shared && ln -svf detail/sha1.hpp /usr/include/boost/uuid/sha1.hpp  

./b2 command prints ./b2 命令打印

ln: failed to create symbolic link '/usr/include/boost/uuid/sha1.hpp': Permission denied ln: 未能创建符号链接 '/usr/include/boost/uuid/sha1.hpp': 权限被拒绝

Then:然后:

sudo apt update
sudo apt install libboost-all-dev

And trying to compile the smart contract:并尝试编译智能合约:

eosio-cpp documentid.cpp -o documentid.wasm

Its giving error:它给出的错误:

 fatal error: 'boost/uuid/uuid.hpp' file not found

Can somebody tell what I am doing wrong?有人能告诉我我做错了什么吗?

I followed all your steps and compiled this code我按照你的所有步骤编译了这段代码

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <iostream>
int main() {
    boost::uuids::uuid uuid = boost::uuids::random_generator()();
    std::cout << uuid << std::endl;
    return 0;
}

Then I compiled with c++ -Wall -std=c++17 -g -I /usr/local/include/ uuid_test.cpp -o uuid_test and it worked fine.然后我用c++ -Wall -std=c++17 -g -I /usr/local/include/ uuid_test.cpp -o uuid_test ,它工作正常。 Telling the linker where to find the uuid.hpp is done with the -I flag.使用-I标志告诉 linker 在哪里可以找到 uuid.hpp。

I got a similar problem while installing AlmaBTE in ubuntu 20.04我在 ubuntu 20.04 中安装 AlmaBTE 时遇到了类似的问题

/home/sy/applications/almabte-v1.3.2/src/superlattice_builder.cpp:38:10: fatal error: boost/uuid/sha1.hpp: No such file or directory
   38 | #include <boost/uuid/sha1.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/superlattice_builder.dir/build.make:63: src/CMakeFiles/superlattice_builder.dir/superlattice_builder.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:474: src/CMakeFiles/superlattice_builder.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

The boost library was okay, however, I find the file 'sha1.hpp' located in another dir. boost 库还可以,但是,我发现文件 'sha1.hpp' 位于另一个目录中。 So I just copied it to the right place and it worked;所以我只是将它复制到正确的位置并且它起作用了;

sudo cp /usr/include/boost/uuid/detail/sha1.hpp /usr/include/boost/uuid/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译错误:致命错误:找不到&#39;boost / numeric / ublas / matrix.hpp&#39;文件 - Compile error : fatal error: 'boost/numeric/ublas/matrix.hpp' file not found 如何修复“致命错误:boost/asio.hpp:没有这样的文件或目录”? - How to fix "fatal error: boost/asio.hpp: no such file or directory"? 致命错误:boost/filesystem.hpp:没有那个文件或目录 - fatal error: boost/filesystem.hpp: No such file or directory CMake 错误:致命错误:如果不使用 find_package() 进行升压,则找不到 boost/asio.hpp - CMake Error: fatal error : boost/asio.hpp not found without using find_package() for boost 找不到&#39;boost / iostreams / device / file_descriptor.hpp&#39;文件错误 - 'boost/iostreams/device/file_descriptor.hpp' file not found ERROR 致命错误:找不到SFML / System.hpp文件 - fatal error: SFML/System.hpp' file not found 增强uuid +增强字节序 - Boost uuid + boost endian boost,c ++和致命错误:boost / random / uniform_int_distribution.hpp:没有此类文件或目录 - boost, c++ and fatal error: boost/random/uniform_int_distribution.hpp: No such file or directory “src/common.hpp:52:32: 致命错误:boost/shared_ptr.hpp: 没有这样的文件或目录”构建 websocket++ 时 - "src/common.hpp:52:32: fatal error: boost/shared_ptr.hpp: No such file or directory" when building websocket++ 致命错误C1083:无法打开包含文件:&#39;boost / variant.hpp&#39;:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM