[odb-users] 'lazy_weak_ptr' is not a member of 'odb'
Neuner Wolfgang
Wolfgang.Neuner at swarovski.com
Fri Mar 24 02:19:35 EDT 2017
i try to use the lazy pointers as described in 6.4.
But i get the following odb compile error:
clib.hxx:40:14: error: 'lazy_weak_ptr' is not a member of 'odb'
std::vector<odb::lazy_weak_ptr<COdbClibRight> > m_ClibRights;
^
clib.hxx:40:14: error: 'lazy_weak_ptr' is not a member of 'odb'
clib.hxx:40:46: error: template argument 1 is invalid
std::vector<odb::lazy_weak_ptr<COdbClibRight> > m_ClibRights;
^
clib.hxx:40:46: error: template argument 2 is invalid
clib.hxx:40:48: error: expected unqualified-id before '>' token
std::vector<odb::lazy_weak_ptr<COdbClibRight> > m_ClibRights;
^
clib.hxx:52:7: error: 'lazy_shared_ptr' in namespace 'odb' does not name a template type
odb::lazy_shared_ptr<COdbAuthMandant> m_AuthMandant;
I included the lazy-ptr header, but the odb compiler cannot find the definition of the lazy pointers.
Where is the problem?
My odb command line:
odb.exe -I C:\Data\Entwicklung\APIs\libodb-2.4.0\ --database mysql --generate-query --generate-schema clib.hxx
My clib.hxx:
#include <odb/lazy-ptr.hxx>
class COdbClibRight;
#pragma db object table("auth_mandant")
class COdbAuthMandant
{
public:
COdbAuthMandant() {};
int GetId() const { return m_iId; };
const std::string& GetName() const { return m_sName; };
void SetName(std::string& name){ m_sName = name; };
const std::string& GetAddress() const { return m_sAddress; };
void SetAddress(std::string& address) { m_sAddress = address; };
private:
#pragma db member id auto column("id") get(GetId)
int m_iId;
#pragma db member column("name") get(GetName) set(SetName) type("VARCHAR(50)")
std::string m_sName;
#pragma db member column("address") get(GetAddress) set(SetAddress) type("VARCHAR(250)")
std::string m_sAddress;
#pragma db member column("contact") get(GetContact) set(SetContact) type("VARCHAR(250)")
std::string m_sContact;
#pragma db member column("factory") get(GetFactory) set(SetFactory) type("VARCHAR(50)")
std::string m_sFactory;
#pragma db value_not_null inverse(m_AuthMandant)
std::vector<odb::lazy_weak_ptr<COdbClibRight> > m_ClibRights;
};
#pragma db object table("clib_right")
class COdbClibRight
{
public:
COdbClibRight() {};
private:
#pragma db not_null
odb::lazy_shared_ptr<COdbAuthMandant> m_AuthMandant;
};
More information about the odb-users
mailing list