[odb-users] unable to map C++ type '::__gnu_cxx::new_allocator<
::std::weak_ptr< ... error in One-to-Many relationships
Monika Idzik
moni.idzik at gmail.com
Fri Sep 6 14:37:51 EDT 2019
What helped me compile, was to add "pointer(std::shared_ptr) to #pragma db
object" in both classes, so like this:
#pragma db object pointer(std::shared_ptr)
class ExperimentCconfiguration
Anyway, thank you for help!
pt., 6 wrz 2019 o 04:59 Boris Kolpackov <boris at codesynthesis.com>
napisał(a):
> Monika Idzik <moni.idzik at gmail.com> writes:
>
> > 1. I put those two classes into one file -> still the same error.
> > 2. I just copied relationship example into my project from examples
> > provided on the website -> still the same error.
>
> I copied the two classes from the manual to test.hpp and adjusted
> it to match your example:
>
> //---------------------------------------------------
> #include <memory>
> #include <vector>
>
> class employee;
>
> #pragma db object
> class position
> {
> public:
> #pragma db id
> unsigned long id_;
>
> #pragma db inverse(position_)
> std::vector<std::weak_ptr<employee>> employee_;
> };
>
> #pragma db object
> class employee
> {
> public:
> #pragma db id
> unsigned long id_;
>
> #pragma db not_null
> std::shared_ptr<position> position_;
> };
> //---------------------------------------------------
>
> I could then successfully compile it like this:
>
> $ odb -d mysql --std c++11 test.hpp
>
> $ odb --version
> ODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.16
>
More information about the odb-users
mailing list