2

Mac Lionのネットワークスニファの既存のソースコードをコンパイルしようとしています。私はlibpcapをインストールしました。ソースにはヘッダファイル/usr/include/net/if.hが含まれており、以下に示すようなコンパイルエラーが発生しています。/usr/include/net/if.hのコンパイルエラー

Floyd:~ Shastry$ gcc -o arplisten arplisten.c -lpcap 
In file included from arplisten.c:4: 
/usr/include/net/if.h:265: error: field ‘ifru_addr’ has incomplete type 
/usr/include/net/if.h:266: error: field ‘ifru_dstaddr’ has incomplete type 
/usr/include/net/if.h:267: error: field ‘ifru_broadaddr’ has incomplete type 
/usr/include/net/if.h:308: error: field ‘ifra_addr’ has incomplete type 
/usr/include/net/if.h:309: error: field ‘ifra_broadaddr’ has incomplete type 
/usr/include/net/if.h:310: error: field ‘ifra_mask’ has incomplete type 
/usr/include/net/if.h:393: error: field ‘addr’ has incomplete type 
/usr/include/net/if.h:394: error: field ‘dstaddr’ has incomplete type 
arplisten.c:6:24: error: netinet/if.h: No such file or directory 
arplisten.c: In function ‘main’: 
arplisten.c:139: warning: incompatible implicit declaration of built-in function ‘strlen’ 
Floyd:~ Shastry$ 

私は無駄のうちに多くのグーグルをしました。誰かがこれで私を助けてくれますか?

答えて

3

ファイルが含まれる順番になっているようです。 googleで見つけたpageを参照してください。

+0

私はif.hを含めた後にすべてを処理しました!ありがとう、トン! – Ashwin