在编译一些代码时,我收到了来自
g++
4.3.4 的以下奇怪消息:
...include/boost/property_tree/stream_translator.hpp: In member function 'typename
boost::enable_if<boost::property_tree::detail::is_translator<Translator>, Type>::type
boost::property_tree::basic_ptree<Key, Data, KeyCompare>::get_value(Translator) const
[with Type = ObjectType, Translator = boost::property_tree::stream_translator<char,
std::char_traits<char>, std::allocator<char>, ObjectType>, Key = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, Data = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, KeyCompare =
std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]':
...include/boost/property_tree/stream_translator.hpp:189: note: 'e' was declared here
附近没有任何警告或错误,我以前从未在
g++
中见过这样的事情。有人知道发生了什么事吗?
这通常发生在模板扩展期间。 GCC 正在尝试提供发生扩展的上下文,以便您有更多信息来解决问题。当您嵌套和/或复杂的模板时,这些“注释”可能非常有用。
修复这些错误的最简单方法是自上而下地工作,纠正您看到的第一个错误并移至下一个错误。
“注释”之前是一个警告,提醒您注意使用新版本 wxWidgets 中标记为已弃用的构造函数创建的类。该注释似乎只是显示了构造函数的已弃用版本的声明位置:
/home/uwake/programs/wx/cuds_db/gp/gpSimple.cpp:157:93: warning:
’wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’
is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants
[-Wdeprecated-declarations]
fnt = wxFont ( 12, wxFONTFAMILY_ROMAN, wxNORMAL, wxNORMAL, false, "Times New Roman" );
^
In file included from /usr/local/include/wx-3.1/wx/font.h:524:0,
from /usr/local/include/wx-3.1/wx/window.h:23,
from /usr/local/include/wx-3.1/wx/wx.h:38,
from /usr/local/include/wx-3.1/wx/wxprec.h:42,
from ./wx_pch.h:14,
from <command-line>:0:
/usr/local/include/wx-3.1/wx/gtk/font.h:89:5: note: declared here
wxFont(int size,
^
就我而言,我通过更改为不同的构造函数来消除警告和注释(尽管不是警告推荐的构造函数,这并不真正符合我的需求)。