Reputation: 3526
I notice that I am getting a ton of warnings when I run code examples from the Boost website. For example, this program:
#include <cassert>
#include <string>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filtering_stream.hpp>
namespace io = boost::iostreams;
int main()
{
using namespace std;
string result;
io::filtering_ostream out(io::back_inserter(result));
out << "Hello World!";
out.flush();
std::cout << result;
}
These are the warnings I get (I've taken out most of the blood and guts):
warning: declaration of 'close' shadows a member of 'this' [-Wshadow]
warning: declaration of 'ptr' shadows a member of 'this' [-Wshadow]
warning: declaration of 'close' shadows a member of 'this' [-Wshadow]
warning: declaration of 'next' shadows a member of 'this' [-Wshadow]
warning: declaration of 'component_type' shadows a member of 'this' [-Wshadow]
warning: declaration of 'close' shadows a member of 'this' [-Wshadow]
warning: declaration of 'component_type' shadows a member of 'this' [-Wshadow]
warning: declaration of 'next' shadows a member of 'this' [-Wshadow]
warning: declaration of 'close' shadows a member of 'this' [-Wshadow]
warning: declaration of 'next' shadows a member of 'this' [-Wshadow]
warning: declaration of 'close' shadows a member of 'this' [-Wshadow]
Why is this happening? Could it be possible that I did something wrong while installing Boost?
Upvotes: 2
Views: 176
Reputation: 392911
Likely this just means the compiler has implemented more stringent warnings.
Upstream will (usually) fix the code for these compilers if your compiler version/platform is supported.
You can usually hide warnings for system headers by doing e.g.
-isystem /path/to/boost
(i.e. instead of -I /path/to/boost
)
Upvotes: 2
Reputation:
It's not just you. Others have also reported this issue. Your code is fine though.
Upvotes: 1