Comments (6)
You can use:
#define WIN32_LEAN_AND_MEAN
#include windows.h
to exclude the windows XML headers. Or this should work (although I haven't confirmed):
tinyxml2::XMLDocument
I don't know a concise solution if you are using the full windows headers and don't want to append the tinyxml2:: everywhere. I'm hoping someone else may know.
from tinyxml2.
@jelemans You're probably importing/using the full namespace, not a good idea (on windows). I would suggest aliasing the namespace, for example:
namespace TinyXML = tinyxml2;
namespace TXML = tinyxml2;
...
TinyXML::XMLDocument ...
TXML::XMLDocument ...
That way it at least looks pretty. :)
from tinyxml2.
I come across the same problem and I solved it like this, in the tinyxml2.cpp brace all the code in the namespace tinyxml2 like this:
#include "tinyxml2.h"
#if 1
#include <cstdio>
#include <cstdlib>
#include <new>
#else
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <new>
#include <stdarg.h>
#endif
namespace tinyxml2
{
class XMLDocument;
class XMLElement;
class XMLAttribute;
class XMLComment;
class XMLNode;
class XMLText;
class XMLDeclaration;
class XMLUnknown;
class XMLPrinter;
// the previous code in this file
} // namespace tinyxml2
// end of the file
from tinyxml2.
I just came across this same issue. I used the idea from @tlh1987 by enclosing the code in the namespace.
Code compiles now on VS 2010, clang 4.1 (OS X) and gcc 4.6.3 (Linux).
from tinyxml2.
@kainjow It dose't work for me , I download the latest version and have added using namespace tinyxml2; to my cpp file.
Compiles on VS2010 Win7 (64Bit) , It's still report the error
from tinyxml2.
I wouldn't use 'using namespace', kind of defeats the purpose of namespaces in the first place. Just use tinyxml2::XMLDocument, etc.
from tinyxml2.
Related Issues (20)
- Converting CString to UTF-8 for saving to TinyXML2 HOT 1
- Problems occur when building a project
- XMLPrinter printer( fp ) not recognised on arduino ide compiler HOT 2
- Why return XML_ ERROR_ PARSING? HOT 2
- Documentation error? HOT 2
- Turkish Characters Support HOT 1
- When will tinyxml release a new version? HOT 1
- Assessment of the difficulty in porting CPU architecture for tinyXML2 HOT 1
- Support for char8_t and std::u8string HOT 2
- Using IntText(); HOT 1
- FirstChildElement and namespace prefixes.
- Bug with XMLElement::Attribute - it returns 0 instead of "value" if it can't find the attribute -
- Is the Doxygen tagfile published anywhere?
- v10: MinGW DLL build behavior change
- porty guide from tinyxml1
- Tags for versions below 2.0.1
- `Error()` returns false for corrupted XML (when there is no starting tag) HOT 1
- Add xmake build system HOT 1
- xmltest.exe fail Error opening test file 'dream.xml'
- Compilation warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinyxml2.