linking problem tinylibxml C++ Ubuntu -
i getting error when try execute simple tinylibxml program.
os -> ubuntu ide -> e have download libtinyxml through apt-get install , included header in program still getting error sample code 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 load file \"%s\"\n", pfilename); } } as, did googling, found need include libtinyxml.cpp , more files. guys , please guide me how that.
thanks
when building need like
g++ -c mycode.cpp (assuming source file mycode.cpp)
this should generate mycode.o
you need do:
g++ -o mycode -ltinyxml mycode.o
which linking step. combine compiled source file tinyxml library produce final executable binary mycode.
for simple stuff can compile , link in 1 step more complex stuff need separate steps out.
all can automated using make , makefile
take @ the gcc manual more info on compiler options.
Comments
Post a Comment