对这个简单的官方提升::iostream代码发出了一系列警告

A bunch of warning was given to this simple official boost::iostream code?

本文关键字:代码 iostream 警告 一系列 简单 官方      更新时间:2023-10-16

我正在字符串中使用boost编写文本文件,官方文档中一个真正简短的例子是:

#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
typedef stream<file_sink> ofstream;
ofstream out("HeavyArtillery.txt"); // Wilfred Owen
out << "Reach at that Arrogance which needs thy harm,n"
       "And beat it down before its sins grow worse.n";
out.close();

我做了几乎相同的事情:

#include <boost/filesystem/path.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
typedef boost::iostreams::stream <boost::iostreams::file_sink> BoostIOStream;
BoostIOStream DebugFileOutputStream("IntermediaArrays.txt");

但上面的代码给出了很多类似下面的警告。我使用的是cuda,所以源文件名为main.cu,但编译器是nmake。有人能告诉我怎么了吗?

1>  Building NVCC (Device) object CMakeFiles/SrmLevelSet.dir/src/Debug/SrmLevelSet_generated_main.cu.obj
1>  main.cu
1>  
1>D:devlibboost_1_58_0boost/iostreams/detail/streambuf/indirect_streambuf.hpp(50): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::~indirect_streambuf [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "std::basic_streambuf<_Elem, _Traits>::~basic_streambuf [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(65): here
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/detail/streambuf/indirect_streambuf.hpp(50): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::~indirect_streambuf [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "boost::iostreams::detail::linked_streambuf<Ch, Tr>::~linked_streambuf [with Ch=char, Tr=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(65): here
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(87): warning : exception specification for virtual function "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::~stream_buffer [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "std::basic_streambuf<_Elem, _Traits>::~basic_streambuf [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(87): warning : exception specification for virtual function "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::~stream_buffer [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "boost::iostreams::detail::linked_streambuf<Ch, Tr>::~linked_streambuf [with Ch=char, Tr=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::ios_base::~ios_base"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::basic_ios<_Elem, _Traits>::~basic_ios [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::basic_ostream<_Elem, _Traits>::~basic_ostream [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::ios_base::~ios_base"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::basic_ios<_Elem, _Traits>::~basic_ios [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::basic_ostream<_Elem, _Traits>::~basic_ostream [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/array.hpp(123): warning : controlling expression is constant
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/array.hpp(129): warning : controlling expression is constant
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/detail/streambuf/indirect_streambuf.hpp(50): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::~indirect_streambuf [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "std::basic_streambuf<_Elem, _Traits>::~basic_streambuf [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(65): here
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/detail/streambuf/indirect_streambuf.hpp(50): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode>::~indirect_streambuf [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "boost::iostreams::detail::linked_streambuf<Ch, Tr>::~linked_streambuf [with Ch=char, Tr=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::indirect_streambuf<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(65): here
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(87): warning : exception specification for virtual function "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::~stream_buffer [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "std::basic_streambuf<_Elem, _Traits>::~basic_streambuf [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream_buffer.hpp(87): warning : exception specification for virtual function "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode>::~stream_buffer [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" is incompatible with that of overridden function "boost::iostreams::detail::linked_streambuf<Ch, Tr>::~linked_streambuf [with Ch=char, Tr=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::stream_buffer<T, Tr, Alloc, Mode> [with T=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Mode=boost::iostreams::output_seekable]" 
1>  
1>  D:devlibboost_1_58_0boost/utility/base_from_member.hpp(127): here
1>  
1>              instantiation of class "boost::base_from_member<MemberType, UniqueID> [with MemberType=boost::iostreams::stream_buffer<boost::iostreams::file_sink, std::char_traits<char>, std::allocator<char>, boost::iostreams::output_seekable>, UniqueID=0]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(75): here
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::ios_base::~ios_base"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::basic_ios<_Elem, _Traits>::~basic_ios [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(74): warning : exception specification for implicitly declared virtual function "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base>::~stream_base [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" is incompatible with that of overridden function "std::basic_ostream<_Elem, _Traits>::~basic_ostream [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during:
1>  
1>              instantiation of class "boost::iostreams::detail::stream_base<Device, Tr, Alloc, Base> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>, Base=std::basic_ostream<char, std::char_traits<char>>]" 
1>  
1>  (112): here
1>  
1>              instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::ios_base::~ios_base"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::basic_ios<_Elem, _Traits>::~basic_ios [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>D:devlibboost_1_58_0boost/iostreams/stream.hpp(112): warning : exception specification for implicitly declared virtual function "boost::iostreams::stream<Device, Tr, Alloc>::~stream [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" is incompatible with that of overridden function "std::basic_ostream<_Elem, _Traits>::~basic_ostream [with _Elem=char, _Traits=std::char_traits<char>]"
1>  
1>            detected during instantiation of class "boost::iostreams::stream<Device, Tr, Alloc> [with Device=boost::iostreams::file_sink, Tr=std::char_traits<char>, Alloc=std::allocator<char>]" 
1>  
1>  D:/SrmLevelSet/src/main.cu(46): here
1>  
1>  
1>  
1>  main.cu
1>  

尽管Boost对NVCC有基本支持(请参阅票据#3919),但它不是用于测试发行版的主要或附加测试编译器之一。有关主要和附加测试编译器的列表,请参阅您正在使用的Boost版本的发行说明。

从您发布的警告来看,NVCC似乎没有正确设置隐式声明的析构函数的异常规范。请参阅C++规范的[除.spec]部分。特别是,如果隐式声明的析构函数f调用的任何函数都允许所有异常,那么它的异常规范应该允许所有异常;如果它调用的所有函数都不允许异常,那么应该不允许任何异常。例如,关于第一个警告,隐式声明的boost::iostreams::detail::indirect_streambuf析构函数应该允许所有异常,因为显式声明的虚拟std::basic_streambuf析构函数允许所有异常(请参见C++规范的[lib.streambuf]部分)。如果非要我猜测的话,看起来NVCC将隐式声明的析构函数的异常规范默认为throw()(C++11中的noexcept)。

有两个警告与不兼容的异常规范无关:

1>D: \dev\lib\boost_1_58_0\boost/array.hpp(123):警告:控制表达式是常量1>1>1>1>D: \dev\lib\boost_1_58_0\boost/array.hpp(129):警告:控制表达式是常量

这可能是由于BOOstrongSERT_MSG回退到使用标准C assert()宏:

# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg))

&&(msg)部分只是一个技巧,它允许消息被包括在被断言的表达式的字符串化中。当msg是字符串文字(常量)时,作为布尔表达式的(msg)将为true。