2015-08-13 47 views
0

我正在爲ARM手機編譯帶有ARM編譯器的調制解調器代碼。
我得到了下面的錯誤:在RVDS 5.01上隱含聲明的函數「typeof」

function "typeof" declared implicitly 

然後我雖然我應該使用__typeof__。但我得到了同樣的錯誤:

function "__typeof__" declared implicitly 

我甚至試過__typeof。但是他們都沒有工作。

爲什麼?

編譯器是RVDS 5.01。 命令行包含在一些腳本中。

的錯誤信息是:

"/opt2/huanglianjun/PD1401V-modem-1.2.1.c1/boot_images/core/storage/ext4/src/com‌​mon/div64.h", line 47: 
Error: #223-D: function "typeof" declared implicitly. 

的代碼是:

#define do_div(n,base) do{ \ 
     uint32_t __base = (base); \ 
     uint32_t __rem; \ 
     (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ 
     if (((n) >> 32) == 0) { \ 
      __rem = (uint32_t)(n) % __base; \ 
      (n) = (uint32_t)(n)/__base; \ 
     } else \ 
      __rem = __div64_32(&(n), __base); \ 
      __rem; \ 
    }while(0) 
+2

也許你的特定編譯器不支持typeof擴展。向我們展示一些相關信息:1.您的編譯器名稱和版本。 2.用於編譯代碼的命令行。 3.你得到確切的錯誤信息。最好是4.你編譯的代碼,一個顯示相同錯誤的最小代碼示例。 – nos

+0

編譯器是RVDS 5.01。命令行包含在一些腳本中。錯誤消息是:「/opt2/huanglianjun/PD1401V-modem-1.2.1.c1/boot_images/core/storage/ext4/src/common/div64.h」,第47行:錯誤:#223-D:function「 typeof「隱式聲明。代碼是#define do_div(n,base)do {\t \t \t \t \ \t uint32_t __base =(base); \t \t \t \ \t uint32_t __rem; \t \t \t \t \t \ \t(void)(((typeof((n))*)0)==((uint64_t *)0)); \t \ \t如果(((N)>> 32)== 0){\t \t \t \ \t \t __rem =(uint32_t的)(N)%__base; \t \t \ \t \t(n)=(uint32_t)(n)/ __base; \t \t \ \t}否則\t \t \t \t \t \t \ \t \t __rem = __div64_32(&(n)時,__base); \t \ \t __rem; \t \t \t \t \t \t \ }而(0) @nos – user1651758

+0

什麼編譯標誌您使用的?我發現的手冊表明RVDS支持一些GCC擴展,包括'typeof',除非給出--strict-ansi或'-ps'。 – nemetroid

回答