0

I'm uncomfortable with some of the syntactical elements of C++, in particular regarding compilation and includes. I was trying to implement the solution listed in the following Q&A:

boost::property_tree::json_parser and two-byte wide characters

In doing so, pasted the suggested template code in an .h file that is being included by my .cpp file. I also added the following to the top of my .cpp, thinking I needed to reference what I'm overriding:

#include "boost/property_tree/detail/json_parser_write.hpp"

I am getting the following compilation error:

Error   11  error C2912: explicit specialization; 'std::basic_string<_Elem,_Traits,_Ax>   boost::property_tree::json_parser::create_escapes(const std::basic_string<_Elem,_Traits,_Ax> &)' is not a specialization of a function template   d:\abr.trunk\e1\livesdencoder\web\encodingservice\h264presentation.h    151

What am I doing wrong to get this override of create_escapes registered for use? Thanks in advance!!

Community
  • 1
  • 1
David Whiteman
  • 110
  • 1
  • 10

1 Answers1

0

Put all in the same .hpp file... remember: templates are like macros... good luck!

Tongas
  • 26
  • 1
  • 3
  • I don't want to edit the boost .hpp file. Do you mean that I should put the template definition in my own .cpp file where I am calling the write_xml function? If I do that, do I need to add something also to my .h file? – David Whiteman Jul 05 '13 at 19:32
  • Good news... I pasted the template into the .cpp file, and it worked. I guess the .h file was the wrong place to put it. Thanks to everyone for the help. – David Whiteman Jul 05 '13 at 21:19