I am getting error when I try to execute the simple tinylibxml program.
OS -> Ubuntu
IDE -> e
I have download libtinyxml through apt-get install
and included the header in my program
But I am still getting error
Sample code is pasted below
#include "tinyxml.h"
#define TIXML_USE_STL
#include <tinyxml.h>
void dump_to_stdout(const char* pFilename);
int main()
{
dump_to_stdout("example1.xml");
return 0;
}
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
bool loadOkay = doc.LoadFile();
if (loadOkay)
{
printf("\n%s:\b", pFilename);
}
else
{
printf("Failed to load file \"%s\"\n", pFilename);
}
}
As, I did googling, I found that I need to include libtinyxml.cpp and some more files.
Could you guys , please guide me how to do that.
Thanks
when building you will need to do something like
g++ -c mycode.cpp(assuming your source file is mycode.cpp)this should generate mycode.o
you now need to do:
g++ -o mycode -ltinyxml mycode.owhich is the linking step. This will combine your compiled source file with the tinyxml library to produce a final executable binary mycode.
For simple stuff you can compile and link in one step but for more complex stuff you need to separate the steps out.
All this can be automated using a
makeand aMakefileTake a look at The GCC Manual for more info on compiler options.