首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用OmniORB4编译Clang++

用OmniORB4编译Clang++
EN

Stack Overflow用户
提问于 2018-02-27 09:51:39
回答 1查看 193关注 0票数 0

我正在使用OmniORB学习Corba,并尝试编译简单的示例程序,但它不起作用。不幸的是,很难找到一些信息来做这件事。

我所做的一切看起来:

  1. 我在idl目录中创建了简单的接口文件 接口IssueAlert { string sendAlert(在字符串警报中);};
  2. 使用omniidl -bcxx -Wbexamples echo.idl编译它
  3. 我得到了结果文件,并使用示例将该代码作为服务器应用程序。 #包括使用命名空间std;类IssueAlert_i : public POA_IssueAlert { IssueAlert_i();虚拟~IssueAlert_i();char* sendAlert(const char* sendAlert);};IssueAlert_i::IssueAlert_i(){} IssueAlert_i::~IssueAlert_i(){} char* IssueAlert_i::sendAlert(const char*警告){ cout << "Upcall:“<<警报<< endl;返回CORBA::string_dup(警报);} ////////////////////////////////////////////////////////////////////// int main(int argc,char** argv){ try { CORBA::ORB_var orb = CORBA::ORB_init(argc,argv);CORBA::Object_var obj =orb-> PortableServer::POA_var _initial_references(“RootPOA”);PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);PortableServer::Servant_var IssueAlert_i=新IssueAlert_i();PortableServer::ObjectId_var issue_id =poa->activate_ object (问题);//获取对对象的引用,并将其打印为// stringified。CORBA::String_var sior( ORB ->object_to_string( obj ));cout << sior << endl;PortableServer::POAManager_var pman =poa->_POAManager();pman->activate();//块,直到ORB关闭。orb->run();}catch (CORBA::SystemException& ex) { cerr <<::<< ex._name() << endl;}catch (CORBA::Exception& ex) { cerr <<捕获CORBA::<<:“<< ex._name() << endl;}”
  4. 要编译它,我使用命令: clang++ -std=c++17 -Wall -Wextra -Wnarrowing -W符号-转换-lomniORB4 -lomnithread -lomniDynamic4 servant.cpp -I/usr/include -L/usr/L 64/ -o服务器

yum安装的所有OmniORB设备都是在/usr/include/usr/lib64中安装的。我明白这个错误:

代码语言:javascript
复制
    /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)

有人能帮我做这个编译-不巧我想做的最后一个项目必须使用C++17,那么最好的办法就是继续使用这个编译器。

EN

回答 1

Stack Overflow用户

发布于 2018-03-01 15:02:58

找到解决办法:

代码语言:javascript
复制
clang++ -std=c++17 -Wall -Wextra -Wnarrowing -Wsign-conversion -lomniORB4 -lomnithread -lomniDynamic4 servant.cpp idl/echoSK.cc -o server

它只需要将echoSK.cc添加到命令中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49005719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档