hAc*_*oCk 6 gdb eclipse-cdt rtti debug-symbols boost-iostreams
我使用Boost :: iostreams同时写入我的控制台和文件.当我使用eclipse进行调试时(当然使用gdb),我会收到一条警告,说明我在Boost :: iostreams中使用的某个类没有找到RTTI符号.
这是重现问题的最小代码.
#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;
}
Run Code Online (Sandbox Code Playgroud)
当我TeeStream cool_cout(my_tee);
在调试期间越线时,我收到以下警告:
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>'
Run Code Online (Sandbox Code Playgroud)
只要遇到对象cool_cout,就会重复警告.我该如何解决?当然,使用此代码的程序可以工作,我也没有问题.警告不应该被忽略,并且有一些关于必须获得的RTTI符号的知识.(我无法使用-f nortti编译,然后可执行文件抱怨rtti肯定应该启用以使用iostreams)
Warnings you should be concerned about are from the compiler, which is what actually creates your program. End users should not be using a debugger, and it has no impact on your binary itself.
While gdb sometimes finds issues, many of the warnings in it are because gdb consumes debug symbols, and the consumer (gdb) has bugs and defencencies . Often they just reduce the functionality of gdb. In this case there is less information about that class available inside the debugger. It makes debugging more difficult, but doesn't hurt the application itself.
You have several choices for what to do about this error.
归档时间: |
|
查看次数: |
12135 次 |
最近记录: |