【问题标题】:#include<boost> no such file or directory#include<boost> 没有这样的文件或目录
【发布时间】:2014-11-07 14:01:07
【问题描述】:

在尝试编译 gnu plot 示例时,g++ 编译器抱怨它找不到位于 /usr/include/boost 中的 boost 库。

准确地说:

致命错误:boost:没有这样的文件或目录#include

我已经使用了命令

g++ -l /usr/include/boost -Wall -std=c++11 -lboost_iostreams exampleplot.cpp -o exampleplot.out

也试过g++ -I /usr/include/boost/* -Wall -std=c++11 -lboost_iostreams exampleplot.cpp -o exampleplot.out 这是我的包括:

#include <iostream> 
#include <cstring>
#include <vector>
#include<cmath>
#include<algorithm>
#include "gnuplot-iostream.h"
#include <boost>

谁能告诉我出了什么问题并建议如何解决?

【问题讨论】:

  • 没有boost 文件。
  • &lt;boost&gt; 不是标准库。请参阅here 了解如何包含您要使用的标头。

标签: c++ linux c++11 boost g++


【解决方案1】:

没有可使用的头文件

#include <boost>

您需要指定要在代码中使用的具体 boost 标头,例如

#include <boost/program_options.hpp>

【讨论】:

  • 这是 c++ 中的新功能,因为我使用的示例只是像我一样提到了 boost
  • @bbpy-newb 这可能是示例中的错误。可以在线购买吗?
  • @bbpy-newb 我不知道。我从来没有以不同的方式使用它。
  • 应该是。我会让他们知道有问题。非常感谢您的帮助。
  • 由于问题删除而暂时离开这里:re your comment 显然不是!我注意到一个趋势,即您经常在帖子上得出错误的结论,经常根据不正确的前提将它们建议为重复。只是提醒一下。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-15
  • 1970-01-01
  • 2014-12-21
  • 2017-01-04
  • 2014-08-31
相关资源
最近更新 更多