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库确实没有找到这几个函数,所以你的工程最好也定义这个宏,不要引用这些方法。

  • 相关阅读:
    Windows中Lua环境配置记录
    《Programming in Lua 3》读书笔记(四)
    《Programming in Lua 3》读书笔记(三)
    《Programming in Lua 3》读书笔记(一)
    C++中的struct
    POJ 1080 Human Gene Functions
    POJ 3176 Cow Bowling
    POJ 2533 Longest Ordered Subsequence
    POJ 1260 Pearls
    POJ 1836 Alignment
  • 原文地址:https://www.cnblogs.com/moon-in-sky/p/3944343.html
Copyright © 2011-2022 走看看