Compiling OmniORB4 with Clang++

I'm learning Corba with OmniORB and try to compile simple example program but it doesn't work. Unfortunately is really hard to find some information how to do it.

What I do looks like:
I made simple interface file in idl directory

interface IssueAlert {
  string sendAlert(in string alert);
};

Open in new window

Compile it using omniidl -bcxx -Wbexamples echo.idl
I get result files and using examples made that code as a server app.

#include "idl/echo.hh"
#include <iostream>
using namespace std;


class IssueAlert_i : public POA_IssueAlert {
  public:
    IssueAlert_i();
    virtual ~IssueAlert_i();
    char* sendAlert(const char* alert);
};

IssueAlert_i::IssueAlert_i(){}
IssueAlert_i::~IssueAlert_i(){}

char* IssueAlert_i::sendAlert(const char* alert){
  cout << "Upcall: " << alert << endl;
  return CORBA::string_dup(alert);
}

//////////////////////////////////////////////////////////////////////

int main(int argc, char** argv){
   try {
     CORBA::ORB_var          orb = CORBA::ORB_init(argc, argv);
     CORBA::Object_var       obj = orb->resolve_initial_references("RootPOA");
     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);

     PortableServer::Servant_var<IssueAlert_i> issue = new 
     IssueAlert_i();

     PortableServer::ObjectId_var issue_id = poa->activate_object(issue);

      // Obtain a reference to the object, and print it out as a
      // stringified IOR.
      obj = issue->_this();
      CORBA::String_var sior(orb->object_to_string(obj));
      cout << sior << endl;

      PortableServer::POAManager_var pman = poa->the_POAManager();
      pman->activate();

      // Block until the ORB is shut down.
      orb->run();
   }catch (CORBA::SystemException& ex) {
     cerr << "Caught CORBA::" << ex._name() << endl;
   }catch (CORBA::Exception& ex) {
     cerr << "Caught CORBA::Exception: " << ex._name() << endl;
   }
   return 0;
}

Open in new window

To compile it i'm using command:
clang++ -std=c++17 -Wall -Wextra -Wnarrowing -Wsign-conversion -lomniORB4 -lomnithread -lomniDynamic4 servant.cpp -I/usr/include -L/usr/lib64/ -o server

Open in new window

All OmniORB things installed by yum are in /usr/include and /usr/lib64. I get that error:

   
 /tmp/servant-e9e6b6.o: In function `IssueAlert_i::IssueAlert_i()':
    servant.cpp:(.text+0x148): undefined reference to `_impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o: In function `IssueAlert_i::~IssueAlert_i()':
    servant.cpp:(.text+0x198): undefined reference to                 `POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o: In function `IssueAlert_i::~IssueAlert_i()':
    servant.cpp:(.text+0x201): undefined reference to `_impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o: In function `POA_IssueAlert::_this()':
    servant.cpp:
    (.text._ZN14POA_IssueAlert5_thisEv[_ZN14POA_IssueAlert5_thisEv]+0x1e): undefined reference to `IssueAlert::_PD_repoId'
    /tmp/servant-e9e6b6.o:(.rodata+0x68): undefined reference to `_impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x70): undefined reference to `_impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x78): undefined reference to `_impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0xf0): undefined reference to `virtual thunk to _impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x100): undefined reference to `virtual thunk to _impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0x120): undefined reference to `virtual thunk to _impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x288): undefined reference to `typeinfo for POA_IssueAlert'
    /tmp/servant-e9e6b6.o:(.rodata+0x290): undefined reference to `POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x298): undefined reference to `POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x2a8): undefined reference to `_impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x2b0): undefined reference to `_impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x2b8): undefined reference to `_impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0x318): undefined reference to `typeinfo for POA_IssueAlert'
    /tmp/servant-e9e6b6.o:(.rodata+0x320): undefined reference to `virtual thunk to POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x328): undefined reference to `virtual thunk to POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x330): undefined reference to `virtual thunk to _impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x340): undefined reference to `virtual thunk to _impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0x360): undefined reference to `virtual thunk to _impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x3c8): undefined reference to `typeinfo for POA_IssueAlert'
    /tmp/servant-e9e6b6.o:(.rodata+0x3d0): undefined reference to `virtual thunk to POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x3d8): undefined reference to `virtual thunk to POA_IssueAlert::~POA_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x458): undefined reference to `typeinfo for _impl_IssueAlert'
    /tmp/servant-e9e6b6.o:(.rodata+0x460): undefined reference to `_impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x468): undefined reference to `_impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x478): undefined reference to `_impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x480): undefined reference to `_impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x488): undefined reference to `_impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0x4e8): undefined reference to `typeinfo for _impl_IssueAlert'
    /tmp/servant-e9e6b6.o:(.rodata+0x4f0): undefined reference to `virtual thunk to _impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x4f8): undefined reference to `virtual thunk to _impl_IssueAlert::~_impl_IssueAlert()'
    /tmp/servant-e9e6b6.o:(.rodata+0x500): undefined reference to `virtual thunk to _impl_IssueAlert::_ptrToInterface(char const*)'
    /tmp/servant-e9e6b6.o:(.rodata+0x510): undefined reference to `virtual thunk to _impl_IssueAlert::_mostDerivedRepoId()'
    /tmp/servant-e9e6b6.o:(.rodata+0x530): undefined reference to `virtual thunk to _impl_IssueAlert::_dispatch(omniCallHandle&)'
    /tmp/servant-e9e6b6.o:(.rodata+0x6d0): undefined reference to `typeinfo for POA_IssueAlert'
    clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

Open in new window

Can someone help me with this compilation - unfortuantelly final project i want to do must use C++17 then best will be to stay with this compiler.
Marcin KarkochaSenior DevOps Engineer (Nokia)Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marcin KarkochaSenior DevOps Engineer (Nokia)Author Commented:
Solution found:
clang++ -std=c++17 -Wall -Wextra -Wnarrowing -Wsign-conversion -lomniORB4 -lomnithread -lomniDynamic4 servant.cpp idl/echoSK.cc -o server

Open in new window

It just require to add echoSK.cc into command.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.