Elvis Dukaj
Elvis Dukaj

Reputation: 7368

MinGW and Boost C++ 1.54.0 warnings

I'm usual to build with consider warning as error. I'm using Boost C++ 1.54.0 with MinGW 4.8.1, in particular I'm using ptree.

#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

This simple program cause the following errors:

typedef 'cons_element' locally defined but not used [-Wunused-local-typedefs] line 228, external location: \boost\tuple\detail\tuple_basic.hpp  
typedef 'Str' locally defined but not used [-Wunused-local-typedefs] line 38, external location: \boost\property_tree\detail\xml_parser_write.hpp
typedef 'Str' locally defined but not used [-Wunused-local-typedefs] line 72, external location: \boost\property_tree\detail\xml_parser_write.hpp
typedef 'T_must_be_placeholder' locally defined but not used [-Wunused-local-typedefs]      line 37, external location: \boost\bind\arg.hpp

Is a way to ignore this warnings?

Upvotes: 2

Views: 1790

Answers (1)

user1283078
user1283078

Reputation: 2006

gcc allows ignoring specific warnings since 4.6

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
...
...
#pragma GCC diagnostic pop

there are still some warnings that cannot be turend off this way, but it works for most

or do it like the other mentioned and add -Wno-unused-local-typedefs to the commandline

Upvotes: 8

Related Questions