Using pugixml in Visual C++ .NET 2010
I am building a GUI for my final project. This project uses pugixml as xml parser for reading some data. Everything works in console mode.
So I started a new windows form project and I added all the headers files I wrote. I desgined my GUI etc. When I try to compile everything compiles but this:
pugixml.cpp(5627): error C2440: 'return' : cannot convert from 'System::String ^' to 'const pugi::char_t *' No us开发者_StackOverflow社区er-defined-conversion operator available, or Cannot convert a managed type to an unmanaged type
Here is the code where the error comes from:
const char_t* convert_number_to_string_special(double value) { #if defined(_MSC_VER) || defined(BORLANDC) if (_finite(value)) return (value == 0) ? PUGIXML_TEXT("0") : 0; if (_isnan(value)) return PUGIXML_TEXT("NaN"); This line----> return PUGIXML_TEXT("-Infinity") + (value > 0);
I tried to change the configuration of the project but I didn't get anything straight.
Any clue? I'd appreciate very much!
Thanks in advance!
This is the compatibility bug; unfortunately, pugixml 1.0 was not fully tested with C++/CLI (as far as I'm aware, this is the only problem with C++/CLI, so after fixing this you can use pugixml safely).
You can either get the most recent version from the repository (http://pugixml.googlecode.com/svn/trunk/) or manually apply the patch: replace the line
return PUGIXML_TEXT("-Infinity") + (value > 0);
with
return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity");
精彩评论