linux环境下编译问题

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

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

 

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

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

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

查看了源代码,原来须要定义宏 BOOST_SYSTEM_NO_DEPRECATEDerror

# 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)要定义这个宏,static

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

相关文章
相关标签/搜索