Boost read_xml error

This code compiles with VS2012/13 but fails with GCC 4.8

1
2
3
4
5
6
7
8
9
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using boost::property_tree::ptree;
ptree data;
std::string raw = util::get_http_data(/*server, file*/);
try
{
	read_xml(std::istringstream(raw), data);
...


The error
C:\Users\Sean\Documents\aBot>g++ -std=c++11 -D_WIN32_WINNT=0x0501 -DWINVER=0x0501 -Iinclude src/Mess
age.cpp src/Connection.cpp src/Utility.cpp src/Logger.cpp src/Bot.cpp src/main.cpp -lWs2_32 -lboost_
system -lboost_filesystem -lboost_date_time
src/Utility.cpp: In function 'std::string sv::util::weather(const string&, const string&)':
src/Utility.cpp:74:42: error: no matching function for call to 'read_xml(std::istringstream, boost::
property_tree::ptree&)'
    read_xml(std::istringstream(raw), data);
                                          ^


All examples of read_xml I find pass it a stringstream. Any help is appreciated.


EDIT: I figured it out, I was passing a temporary to a function that takes a reference.
Last edited on
Topic archived. No new replies allowed.