[odb-users] ODB compiler issue. To-one relation with shared_ptr

Konstantin Tarovik konstantin.tarovik at ab-soft.net
Tue Apr 21 12:17:11 EDT 2015


Hi all,

I have issue with ODB compiler on OSX 10.10. When I try to compile class 
implementing to-one relation with shared_ptr I get the following error:

*>> /Users/user/Documents/Work/SDKs/ODB/odb-2.4.0-i686-macosx/bin/odb -d 
sqlite --generate-schema --generate-query message_imp.hpp**
*
*message_imp.hpp:75:10: error: 'shared_ptr' in namespace 'std' does not 
name a template type**
**     std::shared_ptr<Contact>  _sender;**
**          ^**
**message_imp.hpp:83:28: error: unable to resolve name 
'Message::_sender' in db pragma member**
*
When I compile the same class with shared_ptr changed to auto_ptr ODB 
generates code with no problems but auto_ptr is not suitable for me. I 
use ODB compiler binary downloaded from 
http://www.codesynthesis.com/products/odb/download.xhtml

Class code:

*class Message : public IMessage {**
**public:**
**    Message();**
**    Message(const Message& m);**
**    Message(const std::string& text, int messageId, int conversationId);**
**
**    const std::string& text() const;**
**    void setText(const std::string& text);**
**
**    int messageId() const;**
**    void setMessageId(int messageId);**
****
**    int conversationId() const;**
**    void setConversationId(int conversationId);**
****
//private:

**    std::shared_ptr<Contact> _sender;**
**    std::string _text;**
**    unsigned long _creationTime;**
**    int _conversationId;**
**    int _messageId;**
**};**
**
**#pragma db object(Message)**
**#pragma db member(Message::_sender)**
**#pragma db member(Message::_text)**
**#pragma db member(Message::_creationTime)**
**#pragma db member(Message::_conversationId)**
**#pragma db member(Message::_messageId) id auto**
*
Please advice.

Thank you.

Best regards,
Konstantin Tarovik





More information about the odb-users mailing list