error: ‘INT_MAX’ undeclared 解決辦法

在網上找了一個IEEE1588的程序,還沒仔細看,先看看編譯能否通過,

MAKE了一下,出現如下提示:


sudo make


[sudo] password for eleday:
cc -c -Wall  -o arith.o arith.c
arith.c: In function ‘fromInternalTime’:
arith.c:46: error: ‘INT_MAX’ undeclared (first use in this function)
arith.c:46: error: (Each undeclared identifier is reported only once
arith.c:46: error: for each function it appears in.)
arith.c: In function ‘toInternalTime’:
arith.c:64: error: ‘INT_MAX’ undeclared (first use in this function)
make: *** [arith.o] 錯誤 1


顯示有幾個宏定義沒找到,INT_MAX

其實可以自己在C文件中加#define INT_MAX 4096 ,注意4096是我隨便定義的,具體值是多少,我也沒搞清楚。


或者在文件中加    #include "/usr/include/limits.h"



重新MAKE 一下問題就解決了。

發佈了23 篇原創文章 · 獲贊 5 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章