我无法编译
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.下面是代码,它无法在我的系统上构建:
我在Windows 10上,我使用的是 nuwen MinGW distro版本15.0,不包含git.此版本包含GCC 7.10和Boost 1.64.我已经解压缩MinGw并将其放在我的文件系统的根目录中,并且我遵循MinGW使用说明A来运行set_distro_paths.bat.下面是代码,它无法在我的系统上构建:
矢量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; }
Makefile文件:
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,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库中的include文件中的文件引起的.可以在应用程序级代码或Makefile中进行哪些更改以允许程序编译?