環境:Visual Studioの警告レベルが4に設定されている、ソリューション内の唯一のファイルのコード:
#pragma warning( push )
#pragma warning( disable: 4503 )
#pragma warning( disable: 4702 )
#include <boost/property_tree/ptree.hpp>
#pragma warning ( pop ) //mark
#include "iostream"
int main()
{
boost::property_tree::ptree pt;
for( boost::property_tree::ptree::const_iterator it = pt.begin();
it != pt.end();
++it )
{
std::cout << it->second.data() << '\n';
}
return 0;
}
問題:コンパイル時に警告4503が引き続き表示されます。私が試した他の何か:
- '// mark'の行をアプリの最後の行として配置しますが、効果はありません。
- プッシュ/ポップなしで#pragmawarning(disable:4503 4702)を使用すると機能しますが、ソリューション全体で後でコンパイルされるものに影響します。#pragma warning(default:xx)をどこかに置いても、そうではないようです。警告をデフォルトのステータスに戻します。
なぜこれが起こっているのか、そしてVisualStudioで警告を抑制するための最良の解決策は何であるかを誰が知っていますか。乾杯。