次のような .ini ファイルを解析するためにブースト ライブラリを使用しています。
[head]
type1=val1
type2=cal2
...
私のコードはこれです:
#include <iostream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
using namespace std;
int main()
{
using boost::property_tree::ptree;
boost::property_tree::ptree pt;
boost::property_tree::ini_parser::read_ini("test.ini", pt);
boost::property_tree::ptree::iterator pos1,pos2;
for(pos1 = pt.begin(); pos1 != pt.end() ; ++pos1)
{
cout << pos1->first << endl;
for(pos2 = pos1->second.begin() ; pos2 != pos1->second.end() ; ++pos2)
{
cout << " " << pos2->first << "=" << pos2->second.get_value<string>() << endl;
}
cout << endl;
}
return 0;
}
すべてが機能し、プログラムの出力は期待どおりですが、eclipse はすべての pos1 および pos2 "->" をエラーとしてマークします... Intelli センスは "first" または "second" オプションをロードせず、それらのすべての使用をエラーとしてマークします。 ..それでもすべてがコンパイルされます...
何か案は ??
これがどのように見えるかです: