[odb-users] boost date_time link error

Burton, Craig crburton at tnsi.com
Mon May 21 13:01:25 EDT 2012


Hi Boris,

Thank you for the suggestion.  I rebuilt boost, ensuring that only gcc was used, and again encountered the same link error with my code.  I then looked at the odb example code and was surprised to find that the boost example (with the Oracle DATE type) linked *without* error....  This definitely placed the problem squarely in my code.

Upon closer inspection in my prototype, I found that I had neglected to add "libodb-boost.so" to LFLAGS!  This was the root issue.  Once I added that library, the link step completed without error.

Thanks for the help!
Craig


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Friday, May 18, 2012 10:24 PM
To: Burton, Craig
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] boost date_time link error

Hi Craig,

Burton, Craig <crburton at tnsi.com> writes:

> I've never used the Boost libraries before, but I believe that it
> is necessary to do so in order to utilize the Oracle DATE type.

More precisely, ODB provides a mapping of Oracle data-time types
to Boost data_time library (as well as Qt C++ date-time types).
But you can always map Oracle date-time types to some other
suitable C++ data-time representations if desired (see the
'mapping' example in the odb-examples package for details).

Using Boost (or Qt), is probably the easiest way to get started,
thought.


> My quick test seems to compile ok, but fails during link:
>
> [...]
>
> g++ -lodb -lodb-oracle -lboost_date_time loadNetworkSPData.o NPAC-odb.o
> NPA-odb.o NPACImage-odb.o -o loadNetworkSPData
>
> Undefined                       first referenced
>  symbol                             in file
>
> typeinfo for odb::boost::date_time::special_value NPACImage-odb.o
> vtable for odb::boost::date_time::special_value NPACImage-odb.o

>From your ld output I gather you are using Solaris. The most likely
cause of the above error is that Boost date_time was build with Sun
CC wile you are using GCC to build your application. You will need
to use the same compiler for both. You can either use Sun CC to
build your application (and ODB runtime libraries) or you will
need to rebuild Boost using GCC. For more information on how to
do this, see the Section 5.3, "Or, Build Custom Binaries" in
Boost getting started guide (you will need to use 'gcc' as the
toolchain):

http://www.boost.org/doc/libs/1_49_0/more/getting_started/unix-variants.html#or-build-custom-binaries

Boris

This e-mail message is for the sole use of the intended recipient(s)and may
contain confidential and privileged information of Transaction Network Services.
Any unauthorised review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.




More information about the odb-users mailing list