Trebor Rude
Trebor Rude

Reputation: 1954

What is the Meaning of a "note" from G++ which is NOT Attached to an Error or Warning

While compiling some code, I received the following strange message from 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

There's no warning or error near by, and I've never seen such a thing from g++ before. Does anyone have any idea what's going on?

Upvotes: 1

Views: 13105

Answers (2)

awake
awake

Reputation: 1

I know this is an old thread, but I am suddenly seeing this same thing after upgrading to a newer version of wxWidgets (from 3.0 to 3.1) and also of g++ (now running g++ 5.3.1).

Preceding the "note" is a warning calling attention to a class created using a constructor marked as deprecated in the new version of wxWidgets. The note simply seems to be showing where the deprecated version of the constructor is declared:

/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,
 ^

In my case, I eliminated the warning and the note by changing to a different constructor (though not the one recommended by the warning, which didn't really fit my needs).

Upvotes: 0

Nathan Ernst
Nathan Ernst

Reputation: 4590

GCC, in this case, is attempting to provide context to where a further error occurs. You've only shown a snippet and not the full error, but this is what's happening.

This usually happens during template expansion. GCC is attempting to provide context under which the expansion occurred, so you have more info to fix the issue. These "notes" can be very useful when you've nested and/or complex templates.

The easiest way to fix these errors is to work top-down, correcting the first error you see and move to the next.

Upvotes: 0

Related Questions