Monday, July 31, 2006

Errors Encountered While Integrating the Libpqxx code with our Library.

  1. While integrating the libraries all of them should have the “Runtime Library” property set to “Multi-threaded Debug DLL (/MDd)”. Even if one of the libraries has different runtime library the console application project will give Linking errors. The errors are mostly “error LNK 2005” errors. For example like the one, TestRouteXMLGenerator error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP71D.dll).

Solution: All the libraries should have the “Runtime Library” property set to “Multi-threaded Debug DLL (/MDd)”.

  1. We were building all of our libraries in DEBUG mode and linking the Test console project with DEBUG version of static libraries except that of libpqxx as we did not have its DEBUG version. We got the following (Debug Assertion Failed) error at the point where we used to make the call to the libpqxx code when we linked with the release version of the library.

We did not get this error in the Release version since we were linking with the release version of libpqxx library.


We created the DEBUG verion of the libpqxx library the libqxxd.lib and linked with it.

  1. The struct member alignment problem: The libpqxx library was created using the default struct member alignment of “8 Bytes”. All of our libraries are created using the struct member alignment of “1 Byte”. We got the following error just before the libpqxx code was ended.

Solution: Used #pragma pack to toggle between the two struct member alignments.

We put all the header files of libpqxx between the statements #pragma pack(push,8), to change to 8 bytes and #pragma pop (to get back to original stuct alignment of 1 byte ).

Wednesday, July 26, 2006


I have recently used this TinyXml to create XML DOM Document. It is very easy to use.
It is very light weight as in it just a few header and source files unlike the famous apache xerces.
I have modified the TinyXml package to give XML DOM Document as a string. I have just added a few functions in the tinyxml.h and tinyxml.cpp files.