zoukankan      html  css  js  c++  java
  • linux环境下编译问题

    最近项目刚开始起动,一些底层库编写用到boost,在编译过程中遇到一些奇怪问题,在此记录下

    1.库的连接顺序问题,比如a依赖b,连接的时候要先连接a,eg -L  -a -b;

    2.boost库的问题,库里面用到boost,生成库文件没有问题,但是到工程文件生成引用到库文件的时候,提示:

     undefined reference to `boost::system::get_system_category()'

     undefined reference to `boost::system::get_generic_category()'

    查看了源代码,原来需要定义宏 BOOST_SYSTEM_NO_DEPRECATED

    # ifndef BOOST_SYSTEM_NO_DEPRECATED
      inline const error_category & get_system_category() { return system_category(); }
      inline const error_category & get_generic_category() { return generic_category(); }
      inline const error_category & get_posix_category() { return generic_category(); }
      static const error_category & posix_category = generic_category();
      static const error_category & errno_ecat = generic_category();
      static const error_category & native_ecat = system_category();
    # endif

    所以在生成库文件时候(我的是libkernel.a)要定义这个宏,

    boost system库确实没有找到这几个函数,所以你的工程最好也定义这个宏,不要引用这些方法。

  • 相关阅读:
    Entity SQL 初入
    ObjectQuery查询及方法
    Entity Framework 的事务 DbTransaction
    Construct Binary Tree from Preorder and Inorder Traversal
    Reverse Linked List
    Best Time to Buy and Sell Stock
    Remove Duplicates from Sorted Array II
    Reverse Integer
    Implement Stack using Queues
    C++中const限定符的应用
  • 原文地址:https://www.cnblogs.com/moon-in-sky/p/3944343.html
Copyright © 2011-2022 走看看