linux環境下編譯問題

來源:互聯網
上載者:User

標籤:os   檔案   問題   代碼   sp   amp   linux   line   on   

最近項目剛開始起動,一些底層庫編寫用到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庫確實沒有找到這幾個函數,所以你的工程最好也定義這個宏,不要引用這些方法。

linux環境下編譯問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.