I use Debian Linux. I used the Makefile with the options DEBUG=YES, PROFILE=YES, TINYXML_USE_STL=YES. I took the 4 resulting object files (tinystr.o, tinyxml.o, tinyxmlerror.o, and tinyxmlparser.o) and created a library with the command `ar cr libtinyxml.a tinyxml.o tinystr.o tinyxmlerror.o tinyxmlparser.o`. I put the library in /usr/local/lib and the two .h files (tinystr.h and tinyxml.h) in /usr/local/include/tinyxml.
I #include both .h files in my .cpp file. Everything compiles fine, but I get the error (from ld, run by g++ 4.0.3) "In function TiXmlString::quit() /usr/.../tinystr.h:240: undefined reference to TiXmlString::nullrep_"
Looking at tinystr.h, nullrep_ is in fact used before it is declared. It is used, among other places, on line 240 (as the error message says) but it is not declared until line 249. This begs the question, why in the world is the implementation in the .h file anyway?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think this can only happen if you compile the library with TIMXL_USE_STL=NO and compile the app with TIXML_USE_STL=YES. The entire tinystr should be "compiled out" with the correct TIXML_USE_STL setting.
Is that what happened? Or did a bug slip in to the tinystring code?
thanks,
lee
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use Debian Linux. I used the Makefile with the options DEBUG=YES, PROFILE=YES, TINYXML_USE_STL=YES. I took the 4 resulting object files (tinystr.o, tinyxml.o, tinyxmlerror.o, and tinyxmlparser.o) and created a library with the command `ar cr libtinyxml.a tinyxml.o tinystr.o tinyxmlerror.o tinyxmlparser.o`. I put the library in /usr/local/lib and the two .h files (tinystr.h and tinyxml.h) in /usr/local/include/tinyxml.
I #include both .h files in my .cpp file. Everything compiles fine, but I get the error (from ld, run by g++ 4.0.3) "In function TiXmlString::quit() /usr/.../tinystr.h:240: undefined reference to TiXmlString::nullrep_"
Looking at tinystr.h, nullrep_ is in fact used before it is declared. It is used, among other places, on line 240 (as the error message says) but it is not declared until line 249. This begs the question, why in the world is the implementation in the .h file anyway?
tinystr shouldn't be compiled if you declare TINYXML_USE_STL.
The whole point is to replace the functionnality of std::string for those programmers who can't afford to use the Standard Template Library.
Ah. Thanks.
Perhaps that "detail" should be added to the Makefile?
I think this can only happen if you compile the library with TIMXL_USE_STL=NO and compile the app with TIXML_USE_STL=YES. The entire tinystr should be "compiled out" with the correct TIXML_USE_STL setting.
Is that what happened? Or did a bug slip in to the tinystring code?
thanks,
lee