Boost logo

Boost Users :

Subject: Re: [Boost-users] compilation error using boost/property_tree/ptree.hpp
From: Lars Viklund (zao_at_[hidden])
Date: 2012-06-28 11:49:47


On Thu, Jun 28, 2012 at 11:15:13AM -0400, Pramod Subramanyan wrote:
> 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
>
> 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?

When you get mysterious errors like that, it's probably due to some less
responsible entity defining macros that collide with valid names in your
code.

In this case, I'd expect that someone has "helpfully" made a "fail"
macro.

Preprocess your code (pass -E to your compiler) and look at the true
source the compiler sees.

-- 
Lars Viklund | zao_at_[hidden]

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