tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

How to compile

Open evadogstar opened this issue 7 years ago • 1 comments

Please, help. I build the old project with make&Makefile. Now, I trying to build tinyxml2 at Debian 9.3. First, I tried to use `tinyxml2.h and tinyxml2.cpp' -> tinyxml2.o then added into the project. (latest version from github) But ii report errors:

In file included from tinyxml2/tinyxml2.cpp:24:0: tinyxml2/tinyxml2.h:24:0: error: unterminated #ifndef #ifndef TINYXML2_INCLUDED

In file included from /usr/include/c++/6/new:40:0, from tinyxml2/tinyxml2.cpp:26: /usr/include/c++/6/exception:35:9: error: ‘#pragma’ is not allowed here #pragma GCC visibility push(default) ^~~ In file included from /usr/include/c++/6/new:40:0, from tinyxml2/tinyxml2.cpp:26: /usr/include/c++/6/exception:169:27: error: expected ‘)’ before end of line #pragma GCC visibility pop ^ /usr/include/c++/6/exception:169:24: error: expected ‘;’ at end of member declaration #pragma GCC visibility pop ^~~ /usr/include/c++/6/exception:169:27: error: expected ‘}’ before end of line #pragma GCC visibility pop ^ /usr/include/c++/6/exception:169:27: error: expected unqualified-id before end of line /usr/include/c++/6/exception:169:27: error: expected ‘}’ before end of line /usr/include/c++/6/exception:169:27: error: expected declaration before end of line Makefile:113: recipe for target 'tinyxml2.o' failed make: *** [tinyxml2.o] Error 1

Second, I trying to apt-get install libtinyxml2-dev Then I add -ltinyxml2 to the command line and I also play with -I/usr/lib/x86_64-linux-gnu/ -L/usr/lib/x86_64-linux-gnu/ and both at the same time to get it compiled. But always receive:

Many lines of errors like this: xxx.cpp:(.text+0x47d2): undefined reference to ```tinyxml2::XMLDocument::XMLDocument(bool)' xxx.cpp:(.text+0x4a03): undefined reference to tinyxml2::XMLDocument::SaveFile(char const*)'`

How to use it? Now, I'm looking into "second" solution with libtinyxml2-dev. But also interested what is the problem with first one...

Thanks

evadogstar avatar Dec 11 '17 09:12 evadogstar

Seems found the problem. It include old "tinyxml.h" from the current folder instead of new one.

evadogstar avatar Dec 11 '17 10:12 evadogstar