亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原創

GCC升級到高版本遇到的編譯問題

2024-11-14 09:41:55
157
0

1、背景

從centos7升級到ctyunos時,GCC版本也隨著升級,從4.8.5升級到10.3.1。原來編譯沒報錯,升級后編譯出現大量錯誤,筆者把自己遇到的問題貼出來供參考。

2、問題和解決方法

1、默認編譯選項變化了

    告警:multiple definition of `__ubd_cache_aligned'; .libs/msgreply.o (symbol from plugin):(.text+0x0): first defined here

    解決方法:

           GCC10版本后編譯選項默認:-fno-common,改為-fcommon后原有的代碼才不告警。

2、返回值缺省不為0

       告警:warning: "return with no value, in function returning non-void”

        原因:函數返回定義為int型,返回時沒給值或最后一行沒調用return。

       解決方法: 增加return具體值。例如:return 0;

3、頭文件缺失

     告警(有幾種):

      warning: type of 'sldns_bget_token' does not match original declaration [-Wlto-type-mismatch]

      warning: implicit declaration of function 'assign_sortlist_db_ptr' [-Wimplicit-function-declaration]

     解決方法:找到對應的頭文件,加上即可

4、內聯函數問題

   錯誤:queue.h:108:39: warning: 'always inline"function might not be inlinable [-wattributes]

             void  __attribute__ ((always inline)) queue entry free recur(int index, void *ptr);

   解決方法:內聯函數必須在頭文件(定義和函數體都在頭文件)、并加static修飾。參考dpdk里的ring.h

 

3、總結

高版本檢查嚴格,雖然出現很多告警,但多數還是代碼寫的時候不嚴格,所以還是要養成好的習慣。有的告警特殊情況下也會造成軟件失敗,影響業務。

上面問題解決方法若有誤差,請告知。

0條評論
0 / 1000
候日出
5文章數
1粉絲數
候日出
5 文章 | 1 粉絲
原創

GCC升級到高版本遇到的編譯問題

2024-11-14 09:41:55
157
0

1、背景

從centos7升級到ctyunos時,GCC版本也隨著升級,從4.8.5升級到10.3.1。原來編譯沒報錯,升級后編譯出現大量錯誤,筆者把自己遇到的問題貼出來供參考。

2、問題和解決方法

1、默認編譯選項變化了

    告警:multiple definition of `__ubd_cache_aligned'; .libs/msgreply.o (symbol from plugin):(.text+0x0): first defined here

    解決方法:

           GCC10版本后編譯選項默認:-fno-common,改為-fcommon后原有的代碼才不告警。

2、返回值缺省不為0

       告警:warning: "return with no value, in function returning non-void”

        原因:函數返回定義為int型,返回時沒給值或最后一行沒調用return。

       解決方法: 增加return具體值。例如:return 0;

3、頭文件缺失

     告警(有幾種):

      warning: type of 'sldns_bget_token' does not match original declaration [-Wlto-type-mismatch]

      warning: implicit declaration of function 'assign_sortlist_db_ptr' [-Wimplicit-function-declaration]

     解決方法:找到對應的頭文件,加上即可

4、內聯函數問題

   錯誤:queue.h:108:39: warning: 'always inline"function might not be inlinable [-wattributes]

             void  __attribute__ ((always inline)) queue entry free recur(int index, void *ptr);

   解決方法:內聯函數必須在頭文件(定義和函數體都在頭文件)、并加static修飾。參考dpdk里的ring.h

 

3、總結

高版本檢查嚴格,雖然出現很多告警,但多數還是代碼寫的時候不嚴格,所以還是要養成好的習慣。有的告警特殊情況下也會造成軟件失敗,影響業務。

上面問題解決方法若有誤差,請告知。

文章來自個人專欄
文章 | 訂閱
0條評論
0 / 1000
請輸入你的評論
0
0