Boost logo

Boost Users :

Subject: [Boost-users] [PTree] Failed to compile simple code
From: Klaim (mjklaim_at_[hidden])
Date: 2010-06-20 15:21:09


Hi!
I'm trying to use boost::property_tree but can't compile this simple
code on VC10 :

#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/info_parser.hpp>

const std::string CONFIG_FILE = "game.cfg";

int main()
{
        using namespace boost::property_tree;
        ptree properties; // compilation error here

        //read_info( CONFIG_FILE, properties );

        return 0;
}

The compilation log :

Main.cpp
d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(30):
error C2440: 'specialization' : cannot convert from 'const std::string
std::_Pair_base<_Ty1,_Ty2>::* ' to 'const
std::basic_string<_Elem,_Traits,_Ax> std::pair<_Ty1,_Ty2>::* '
          with
          [
              _Ty1=const std::string,
              _Ty2=boost::property_tree::basic_ptree<std::string,std::string>
          ]
          and
          [
              _Elem=char,
              _Traits=std::char_traits<char>,
              _Ax=std::allocator<char>,
              _Ty1=const std::string,
              _Ty2=boost::property_tree::basic_ptree<std::string,std::string>
          ]
          Standard conversion from pointer-to-member of base to
pointer-to-member of derived is not applied for template arguments
          d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159)
: see reference to class template instantiation
'boost::property_tree::basic_ptree<Key,Data>::subs' being compiled
          with
          [
              Key=std::string,
              Data=std::string
          ]
          d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159)
: while compiling class template member function
'boost::property_tree::basic_ptree<Key,Data>::basic_ptree(void)'
          with
          [
              Key=std::string,
              Data=std::string
          ]
          d:\tests\test_ptree\test_ptree\main.cpp(11) : see reference
to class template instantiation
'boost::property_tree::basic_ptree<Key,Data>' being compiled
          with
          [
              Key=std::string,
              Data=std::string
          ]

As I'm using a default ptree typedef that is already used in the
tutorial, I think I might be doing something stupid but I can't find
what.
I tried that with boost 1.42 and 1.43, both failed.
Any idea?

Thanks

Joël Lamotte


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net