編譯常見問題集

2021-09-25 21:58:20 字數 1134 閱讀 8187

warning: incompatible implicit declaration of built-in function 『memset』 [enabled by default]

原因:呼叫了memset,用於初始化記憶體中的資料,但是沒有指定memset這個函式來自於**。

解決方法:在檔案頭加入#include

warning: assignment from incompatible pointer type [enabled by default]

原因:指標的型別不一致

解決方法:把指標型別強制轉換一下,使其一致

warning: comparison between pointer and integer [enabled by default]

原因:指標與整數進行比較,比較的資料型別不一致;

解決:*clientrtcpportnum = (streamingmode == raw_udp ? 0 : p1 + 1);

streamingmode本身是個指標,漏掉了乙個 *

修改為:*clientrtcpportnum = (*streamingmode == raw_udp ? 0 : p1 + 1);警告解決。

warning: implicit declaration of function 『close』 [-wimplicit-function-declaration]

解決方法:在檔案頭加入#include

warning: implicit declaration of function 『pthread_detach』 [-wimplicit-function-declaration]

解決方法:在檔案頭加入#include

報錯:error: jump to label [-fpermissive]

解決方法:

原因很簡單,goto 之後,又出現了新定義的變數。

在goto之前定義變數即可解決。

交叉編譯常見問題

1 新增環境變數 網上的解決辦法很多 2 找不到編譯器 在用交叉編譯器時遇到的問題 解決了 su 輸入密碼,這樣就進入了root使用者許可權,這個時候再輸入下面命令 source etc profile 結果問題就解決了 最後查詢su 和sudo 的區別,終於理解了,原來是工作環境的問題。希望此貼以...

gcc編譯常見問題

inux c gcc lm 1.為什麼會出現undefined reference to xx 錯誤?首先這是鏈結錯誤,不是編譯錯誤,也就是說如果只有這個錯誤,說明你的程式原始碼本身沒有問題,是你用編譯器編譯時引數用得不對,你沒有指定鏈結程式要用到得庫 比如你的程式裡用到了一些 數學函式 那麼你就要...

gcc g 編譯常見問題

這是因為gcc基於c89標準,換成c99標準就可以在for迴圈內定義i變數了 gcc src.c std c99 o src 2.cpp引用.c檔案 需要給.c檔案編寫個頭檔案才可以 3.relocation r x86 64 pc32 against undefined symbol decode...