Reputation: 41
I am trying to include the TinyXml library to my Visual Studio C++ project with no success.
I have downloaded the library folder with the .h and .cpp files and tried all kind of adding... it doesn't help...
I found this tutorial, and did as it told.
It still does not recognize #include "xmlEffect.h"
Any suggestions most welcome.
Upvotes: 0
Views: 8844
Reputation: 4003
I think Michael Yudchak's downvote a little unfair. His written English could have been better but his question I think was still valid.
The example usage given by Step 5 of the tutorial gives an example of using "xmlEffect.h" without explaining where it comes from or what it is:
#include "xmlEffect.h"
int main(void)
{
char c;
xmlSetting xmlset;
xmlset.saveEffectXML("test.xml","child1","child2","3000","4000");
xmlset.loadEffectXML("test.xml");
c=getchar();
}
The solution therefore is to follow the first four steps, as it says, but ignore Step 5 and just try out an example of your own. Example minimalist "Hello World" example:
Example XML: test.xml
<?xml version="1.0" ?>
<Hello>World</Hello>
Example code: main.cpp
#include "tinyxml.h"
#include <string>
int main()
{
TiXmlDocument doc( "test.xml" );
if ( doc.LoadFile() )
{
TiXmlElement* element = doc.FirstChildElement( "Hello" );
std::string text = element->GetText();
}
return 0;
}
Upvotes: 2
Reputation: 1516
Take a look again at Step Four.
Step Four
Copy the following files to your project folder
- tinystr.h
- tinyxml.h
- tinyxmlparser.cpp
- tinystr.cpp
- tinyxml.cpp
- tinyxmlerror.cpp
from solution explorer add these file to your project as (Add >> Existing Item)
If your projects structure is like this:
Project
|-- Debug
|-- src
|
|-- inc
| |
| +-- xmlEffect.h
|
+-- main.cpp
Then #include "inc/xmlEffect.h"
instead of #include "xmlEffect.h"
Upvotes: 2