2
我通常會建議考慮警告爲錯誤。我使用Boost C++ 1.54.0和MinGW 4.8.1,特別是我使用ptree。MinGW和Boost C++ 1.54.0警告
#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;
}
這個簡單的程序會導致以下錯誤:
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
是無視這種警告的方法嗎?
那是因爲你有'-Wunused-local-typedefs'編譯選項就把它刪除,一切都很好! – Boynux
我alawys用-Wall構建,不幸的是gcc不允許選擇警告。 –
這個問題似乎是在啓動,嘗試編譯沒有'-Wall'並查看結果!你也可以使用'-Wno-unused-local-typedefs'我不確定它是否有效! – Boynux