简体   繁体   English

boost,c ++和致命错误:boost / random / uniform_int_distribution.hpp:没有此类文件或目录

[英]boost, c++ and fatal error: boost/random/uniform_int_distribution.hpp: No such file or directory

Below is my list of includes. 以下是我的包含清单。 When I run the program I get this error.. 当我运行程序时,出现此错误。

fatal error: boost/random/uniform_int_distribution.hpp: No such file or directory

Well...problem is the file is there and when I comment out the include the other files are found and the program compiles. 好吧...问题是文件在那里,当我注释掉包含文件时,找到了其他文件,程序得以编译。 I really don't understands how this happens. 我真的不明白这是怎么发生的。 Any explanation? 有什么解释吗?

My boost home is /home/ubuntu/boost/ so the path is /home/ubuntu/boost/boost/random/uniform_int_distribution.hpp 我的增强之家是/ home / ubuntu / boost /,因此路径是/home/ubuntu/boost/boost/random/uniform_int_distribution.hpp

Here is how I invoke: 这是我的调用方式:

 g++ rtb.cpp -o rtb.o -L/home/ubuntu/boost  -L/usr/local/include/ -lfcgi++

Here are te includes 这里是包括

#include <boost/tokenizer.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/bimap.hpp>
#include <boost/multi_array.hpp>
#include <cassert>
#include <boost/config.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <boost/tuple/tuple.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <map>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/member.hpp>

The problem is that you are using -L (which gives the directories where the libraries of object files can be found) when you should use -I giving the directory where the compiler will look for include files 问题是,当您应该使用-I时,您正在使用-L(它提供了可以找到目标文件库的目录)-I给出了编译器将在其中查找包含文件的目录

gcc's documentation for library search also from gcc /usr/local/include is always included. 总是包含来自gcc / usr / local / include的gcc 库搜索文档

Thus from @nttstar's answer that the uniform_int_distribution.hpp header was added in boost 1.47 an before that there's only uniform_int.hpp. 因此,从@nttstar的答案来看,在boost 1.47及更高版本中添加了junit_int_distribution.hpp标头,在此之前,只有uniform_int.hpp。

I think the reason why you see the error just for this one header is that you are finding an older boost in /usr/local/include 我认为您仅在此标头中看到错误的原因是您在/ usr / local / include中找到了较旧的增强功能

Agree with Mark. 同意马克。

If you only has problem with uniform_int_distribution.hpp, you should check your boost version. 如果仅对uniform_int_distribution.hpp有问题,则应检查增强版本。

The uniform_int_distribution.hpp header was added in boost 1.47. 在boost 1.47中添加了Uniform_int_distribution.hpp标头。 Before that there's only uniform_int.hpp. 在此之前,只有uniform_int.hpp。 You can review the 1.46 random library docs here 您可以在此处查看1.46随机库文档

暂无
暂无

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

相关问题 boost / random / uniform_int.hpp和boost / random / uniform_int_distribution.hpp可以互换使用吗? - Can boost/random/uniform_int.hpp and boost/random/uniform_int_distribution.hpp be used interchangeably? 如何修复“致命错误: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 致命错误C1083:无法打开包含文件:&#39;boost / variant.hpp&#39;:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory 致命错误 C1083:无法打开包含文件:“boost/config.hpp”:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory 是否可以为boost :: random :: uniform_int_distribution &lt;&gt;设置确定性种子? - Is it possible to set a deterministic seed for boost::random::uniform_int_distribution<>? 产生致命错误:boost / fusion / iterator / equal_to.hpp没有这样的文件或目录 - make fatal error: boost/fusion/iterator/equal_to.hpp no such file or directory 在Eclipse中使用CUTE:致命错误:boost / type_traits / is_integral.hpp:没有这样的文件或目录 - using CUTE in Eclipse: fatal error: boost/type_traits/is_integral.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++ CMake 项目 Boost 库错误:boost/config/compiler/gcc.hpp:165:10: fatal error: cstddef: No such file or directory - CMake project Boost library error : boost/config/compiler/gcc.hpp:165:10: fatal error: cstddef: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM