【问题标题】:error: 'make_array' is not a member of 'boost::serialization错误:“make_array”不是“boost::serialization”的成员
【发布时间】:2017-11-16 00:00:39
【问题描述】:

我无法编译basic boost vector example。 我在 Windows 10 上,我使用的是 nuwen MinGW distro 版本 15.0,不包含 git。此版本包含 GCC 7.10 和 Boost 1.64。我已经解压了 MinGw 并将其放在我的文件系统的根目录中,并且我按照 MinGW 使用说明 A 运行 set_distro_paths.bat。以下是无法在我的系统上构建的代码:

vector-fail.cpp:

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
    using namespace boost::numeric::ublas;
    vector<double> v (3);
    for (unsigned i = 0; i < v.size (); ++ i)
        v (i) = i;
    std::cout << v << std::endl;
}

生成文件:

vector-fail: vector-fail.o
    g++ vector-fail.o -o vector-fail
vector-fail.o: vector-fail.cpp
    g++ -c vector-fail.cpp -o vector-fail.o

输出:

g++ -c vector-fail.cpp -o vector-fail.o
In file included from C:\MinGW\include/boost/numeric/ublas/vector.hpp:21:0,
                 from vector-fail.cpp:1:
C:\MinGW\include/boost/numeric/ublas/storage.hpp: In member function 'void 
boost::numeric::ublas::unbounded_array<T, ALLOC>::serialize(Archive&, unsigned int)':
C:\MinGW\include/boost/numeric/ublas/storage.hpp:299:33: error: 'make_array' is not a member of 'boost::serialization'
              ar & serialization::make_array(data_, s);
                                  ^~~~~~~~~~
C:\MinGW\include/boost/numeric/ublas/storage.hpp:299:33: note: suggested alternative: 'make_nvp'
             ar & serialization::make_array(data_, s);
                                 ^~~~~~~~~~
                             make_nvp
C:\MinGW\include/boost/numeric/ublas/storage.hpp: In member function 'void boost::numeric::ublas::bounded_array<T, N, ALLOC>::serialize(Archive&, unsigned int)':
C:\MinGW\include/boost/numeric/ublas/storage.hpp:494:33: error: 'make_array' is not a member of 'boost::serialization'
             ar & serialization::make_array(data_, s);
                                 ^~~~~~~~~~
C:\MinGW\include/boost/numeric/ublas/storage.hpp:494:33: note: suggested alternative: 'make_nvp'
             ar & serialization::make_array(data_, s);
                                 ^~~~~~~~~~
                                 make_nvp
make: *** [Makefile:5: vector-fail.o] Error 1

不幸的是,这些错误都没有发生在我的代码中,而是由 boost 库本身的包含文件中的文件引起的。可以在应用程序级代码或 Makefile 中进行哪些更改以允许程序编译?

【问题讨论】:

  • 你是如何安装 boost 的?

标签: c++ windows gcc boost mingw


【解决方案1】:

是的,这是 ublas 标头的问题。我之前碰到过。您可以通过包含

来解决它
#include <boost/serialization/array_wrapper.hpp>

在那之前。我会考虑将其报告给 ublas 代码的维护者。

【讨论】:

  • 这行得通!但仅当您将 array_wrapper 的 include 放在 vector 的 include 之前。
  • 2017 年了,还没有修复?
  • @Knowledge 这也是 2017 年 6 月,供您参考。
  • @sehe 在 6 月 14 日 12:12 回答 我还读到 ublast 自 2009 年以来没有显着更新,所以 :DI 猜我会坚持数字接收
  • @Knowledge 是的,就在一个月前。 [您认为 14 年 6 月吗?] TTBOMK, NR 自 1996 年以来一直没有更新(我的副本是 C,自 1992 年以来),除非您参考 ICTP 版本...需要闪存,所以我不知道。在旁注中,ublast 听起来像是一个很棒的图书馆名称 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-12-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-02
  • 1970-01-01
相关资源
最近更新 更多