title: IDL interface, C++, CORBA, I'm dealing with "conflicting return type specified for" and "invalid abstract return type for member function ‘virtual..."
body: <p>For over 3 days I've been dealing with CORBA and C++ and my app interface written in IDL.</p>
  
  <p>My app interface looks like this:</p>
  
  <pre><code>#ifndef __FORUM_INTERFACE_IDL__
  #define __FORUM_INTERFACE_IDL__
  
  #include "Forum.idl"
  typedef sequence&lt;Forum&gt; Forums;
  
  interface ForumInterface
  {
      Forums getForumList(in Forum f);
      Forums getUsersForumList(in long UsersID);
      void addNewTopic(in Forum f, in long UsersID, in string title);
  };
  
  #endif
  </code></pre>
  
  <p><strong>I "compile" it to *.hh and *.cc files by : omniidl -bcxx ForumInterface.idl</strong></p>
  
  <p>My Forum-object (also defined in IDL) looks like:</p>
  
  <pre><code>#ifndef __FORUM_IDL__
  #define __FORUM_IDL__
  
  interface Forum
  {
      long getForumID();
      void setForumID(in long id);
      string getForumName();
      void setFroumName(in string name);
      Forum getForumParent();
      void setForumParent(in Forum f);
  };
  
  #endif
  </code></pre>
  
  <p><strong>I "compile" it to *.hh and *.cc files by : omniidl -bcxx Forum.idl</strong></p>
  
  <p>I tried to write an implementation of both Forum and ForumInterface. I started with Forum, here's definition of class FroumImpl:</p>
  
  <pre><code>#ifndef __FORUMIMPL_H__
  #define __FORUMIMPL_H__
  
  #include "Forum.hh"
  
  class ForumImpl : public POA_Forum
  {
      private :
  
          long id;
          char *name;
          ForumImpl parent;
  
      public :
  
          long getForumID();
          void setForumID(long id);
          char* getForumName();
          void setFroumName(const char* name);
          ForumImpl getForumParent();
          void setForumParent(ForumImpl f);
  };
  
  #endif
  </code></pre>
  
  <p>and it's declaration (for now it's empty):</p>
  
  <pre><code>#include "ForumImpl.h"
  
  long ForumImpl::getForumID(){}
  void ForumImpl::setForumID(long id){}
  char* ForumImpl::getForumName(){}
  void ForumImpl::setFroumName(const char* name){}
  ForumImpl ForumImpl::getForumParent(){}
  void ForumImpl::setForumParent(ForumImpl f){}
  </code></pre>
  
  <p>I tried to compile it, </p>
  
  <pre><code>g++ -c ForumImpl.cpp -I$OMNIORB_HOME/include -I$OMNIORB_HOME/include/omniORB4
  </code></pre>
  
  <p>but got errors:</p>
  
  <blockquote>
    <p>In file included from ForumImpl.cpp:1:0: ForumImpl.h:12:19: error:
    field ‘parent’ has incomplete type ForumImpl.h:20:19: error:
    conflicting return type specified for ‘virtual ForumImpl
    ForumImpl::getForumParent()’ Forum.hh:161:21: error:   overriding
    ‘virtual _objref_Forum* _impl_Forum::getForumParent()’
    ForumImpl.h:20:19: error: invalid abstract return type for member
    function ‘virtual ForumImpl ForumImpl::getForumParent()’
    ForumImpl.h:6:7: note:   because the following virtual functions are
    pure within ‘ForumImpl’: Forum.hh:162:16: note:  virtual void
    _impl_Forum::setForumParent(Forum_ptr) ForumImpl.h:21:14: error: cannot declare parameter ‘f’ to be of abstract type ‘ForumImpl’
    ForumImpl.h:6:7: note:   since type ‘ForumImpl’ has pure virtual
    functions ForumImpl.cpp: In member function ‘virtual ForumImpl
    ForumImpl::getForumParent()’: ForumImpl.cpp:7:11: error: invalid
    abstract return type for member function ‘virtual ForumImpl
    ForumImpl::getForumParent()’ ForumImpl.h:6:7: note:   since type
    ‘ForumImpl’ has pure virtual functions ForumImpl.cpp: At global scope:
    ForumImpl.cpp:8:42: error: cannot declare parameter ‘f’ to be of
    abstract type ‘ForumImpl’ ForumImpl.h:6:7: note:   since type
    ‘ForumImpl’ has pure virtual functions</p>
  </blockquote>
  
  <p>the worst thing is I have no idea why this code gives me such errors ... I mean, I defined all of <code>ForumImpl</code> functions ... so any of them is virtual now. I spent hours and hours trying figure out what's wrong with this but have no clue :( </p>
  
  <p>Could anyone help? <strong>My files: <a href="http://www6.zippyshare.com/v/69552292/file.html" rel="nofollow">http://www6.zippyshare.com/v/69552292/file.html</a> I added to this tar archive a Makefile, so simply run command "make all" and this will do everything</strong>. </p>
  
  <p>I would be very grateful if anyone could tell my why I got those error and what to do to fix this, I really need it. Cheers:)</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I changed my ForumImpl.h and ForumImpl.cpp:</p>
  
  <pre><code>#ifndef __FORUMIMPL_H__
  #define __FORUMIMPL_H__
  
  #include "Forum.hh"
  
  class ForumImpl : public POA_Forum
  {
      private :
  
          long id;
          char *name;
          ForumImpl *parent;
  
      public :
  
          long getForumID();
          void setForumID(long id);
          char* getForumName();
          void setFroumName(const char* name);
          ForumImpl* getForumParent();
          void setForumParent(ForumImpl *f);
  };
  
  #endif
  
  #include "ForumImpl.h"
  long ForumImpl::getForumID(){}
  void ForumImpl::setForumID(long id){}
  char* ForumImpl::getForumName(){}
  void ForumImpl::setFroumName(const char* name){}
  ForumImpl* ForumImpl::getForumParent(){}
  void ForumImpl::setForumParent(ForumImpl *f){}
  </code></pre>
  
  <p>but this gave me those erros:</p>
  
  <blockquote>
    <p>g++ -c ForumImpl.cpp -IMNIORB_HOME/include
    -IMNIORB_HOME/include/omniORB4 In file included from ForumImpl.cpp:1:0: ForumImpl.h:20:20: error: invalid covariant return
    type for ‘virtual ForumImpl* ForumImpl::getForumParent()’
    Forum.hh:161:21: error:   overriding ‘virtual _objref_Forum*
    _impl_Forum::getForumParent()’</p>
  </blockquote>