Boost logo

Boost Users :

Subject: [Boost-users] compilation error using boost/property_tree/ptree.hpp
From: Pramod Subramanyan (pramod.subramanyan_at_[hidden])
Date: 2012-06-28 11:15:13


I am trying to use boost/property_tree/ptree.hpp in my application. All I
have done so far is just add the following include statements to my program:

> #include <boost/property_tree/ptree.hpp>
> #include <boost/property_tree/xml_parser.hpp>

After adding these lines, I compiled my modified application using g++
4.6.3 on Ubuntu 12.04. I get the following errors:

g++ -c -Wall -Werror -I../cudd-2.4.2//include/ -I
/home/pramod/libraries/boost_1_50_0/ -O2 -Wno-unused-result
-Wno-unused-function -c -o main.o main.cpp
In file included from
/home/pramod/libraries/boost_1_50_0/boost/property_tree/ptree.hpp:17:0,
                 from main.h:10,
                 from main.cpp:17:
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:
In static member function ‘static void
boost::property_tree::customize_stream<Ch, Traits, bool,
void>::extract(std::basic_istream<_CharT, _Traits>&, bool&)’:
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:117:18:
error: expected unqualified-id before ‘{’ token
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:117:18:
error: expected ‘)’ before ‘{’ token
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:
In member function ‘boost::optional<E>
boost::property_tree::stream_translator<Ch, Traits, Alloc,
E>::get_value(const internal_type&)’:
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:191:20:
error: expected unqualified-id before ‘{’ token
/home/pramod/libraries/boost_1_50_0/boost/property_tree/stream_translator.hpp:191:20:
error: expected ‘)’ before ‘{’ token
make: *** [main.o] Error 1

When I look the lines117 and 191 in ptree.hpp, they are the following:

            s >> e;
            if(s.fail()) {
                // Try again in word form.

and
            customized::extract(iss, e);
            if(iss.fail() || iss.bad() || iss.get() != Traits::eof()) {
                return boost::optional<E>();

I can't spot anything obviously wrong with either of these lines.

Does anyone have any clues on what could be going wrong?

Thanks!
Pramod



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