Gdb 使用boost::iostreams时未找到警告消息RTTI符号

Gdb 使用boost::iostreams时未找到警告消息RTTI符号,gdb,eclipse-cdt,rtti,debug-symbols,boost-iostreams,Gdb,Eclipse Cdt,Rtti,Debug Symbols,Boost Iostreams,我使用Boost::iostreams同时写入控制台和文件。当我使用eclipse进行调试(当然是使用gdb)时,我从Boost::iostreams中收到一条警告,指出我正在使用的一个类找不到RTTI symbol 下面是重现问题的最少代码 #ifndef BOOST_IO_STREAM_H_ #define BOOST_IO_STREAM_H_ #include <fstream> #include <boost/iostreams/tee.hpp> #includ

我使用Boost::iostreams同时写入控制台和文件。当我使用eclipse进行调试(当然是使用gdb)时,我从Boost::iostreams中收到一条警告,指出我正在使用的一个类找不到RTTI symbol

下面是重现问题的最少代码

#ifndef BOOST_IO_STREAM_H_
#define BOOST_IO_STREAM_H_

#include <fstream>
#include <boost/iostreams/tee.hpp>
#include <boost/iostreams/stream.hpp>
using boost::iostreams::tee_device;
using boost::iostreams::stream;

typedef tee_device<std::ostream, std::ofstream> TeeDevice;
typedef stream<TeeDevice> TeeStream;

#endif /* BOOST_IO_STREAM_H_ */

int
main()
{

  /* A config file to output experiment details */
  std::string self_filename = "./experimentconfig.txt";
  std::ofstream fconfig(self_filename.c_str());
  TeeDevice my_tee(std::cout, fconfig);
  TeeStream cool_cout(my_tee);

  cool_cout << "Output to file and console during experiment run" << std::endl;

  return 0;
}

每当遇到对象冷却时,都会重复这些警告。我该如何解决这个问题?当然,使用此代码的程序可以工作,我对此没有任何问题。警告不应被忽视,必须获得一些关于RTTI符号的知识。(我无法使用-f nortti进行编译,然后可执行文件抱怨rtti肯定应该启用以使用iostreams)

您应该关注的警告来自编译器,而编译器正是创建程序的真正原因。最终用户不应该使用调试器,调试器对二进制文件本身没有影响

虽然gdb有时会发现问题,但其中的许多警告是因为gdb使用调试符号,而使用者(gdb)有bug和防御措施。通常,它们只是减少了gdb的功能。 在这种情况下,调试器中关于该类的可用信息较少。它使调试更加困难,但不会损害应用程序本身

对于如何处理此错误,您有多种选择

  • 忽略gdb中的警告,继续生活
  • 获取gdb的源代码,尝试查找问题并提交补丁。我相信它会受到欢迎
  • 使用不同的调试器。(不过我看到的所有替代品都是付费产品。)
  • 重写程序以不使用任何模板。gdb模板处理是存在大多数符号查找问题的地方

  • 谢谢你的回答。如果我有足够的时间,我愿意选择去。无论如何,我将与gdb开发人员通信。但是我没有选择。我刚刚使用了Boost库,我怎么能不使用模板呢?
    warning: RTTI symbol not found for class 'boost::iostreams::stream<boost::iostreams::tee_device<std::ostream, std::basic_ofstream<char, std::char_traits<char> > >, std::char_traits<char>, std::allocator<char> >'
    warning: RTTI symbol not found for class 'boost::iostreams::stream_buffer<boost::iostreams::tee_device<std::ostream, std::basic_ofstream<char, std::char_traits<char> > >, std::char_traits<char>, std::allocator<char>, boost::iostreams::output>'