我正在使用Linux Mint 13,並且正在研究「Unix網絡編程:進程間通信」一書。我下載了本書的源代碼 - http://www.kohala.com/start/unpv22e/unpv22e.html - 並按照說明操作。無法構建「Unix網絡編程:進程間通信」的源代碼
首先,我跑在基本目錄
然後,我去到lib目錄並運行做出的./configure。這提供了以下錯誤 -
gcc -c "/home/linux/Code/c/unix_network_programming/main.c" -g -o ./Debug/main.o "-I." "-I."
In file included from /usr/lib/gcc/i686-linux-gnu/4.6/include/stdint.h:3:0,
from /usr/include/netinet/in.h:24,
from /usr/include/rpc/types.h:91,
from /usr/include/rpc/rpc.h:38,
from /home/linux/Code/c/unix_network_programming/unpipc.h:115,
from /home/linux/Code/c/unix_network_programming/main.c:2:
/usr/include/stdint.h:49:24: error: duplicate ‘unsigned’
/usr/include/stdint.h:49:24: error: two or more data types in declaration specifiers
/usr/include/stdint.h:50:28: error: duplicate ‘unsigned’
/usr/include/stdint.h:50:28: error: duplicate ‘short’
/usr/include/stdint.h:52:23: error: duplicate ‘unsigned’
/usr/include/stdint.h:52:23: error: two or more data types in declaration specifiers
下面是是給錯誤的文件 -
#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif
如何爲我很少ç經驗修正此錯誤任何想法?
你可以運行'autoconf'來重建configure腳本。 – pce 2013-03-25 17:20:36
Yuck yuck yuck!問題出在AC_UNP_CHECK_TYPE中,這是一個令人不快的宏。問題在於代碼是針對沒有stdint.h的略舊的系統編寫的,系統的netinet頭文件中包含stdint.h。糟糕的是,AC_UNP_CHECK_TYPE做了一個「#define uint8_t unsigned char」而不是使用typedef,所以當真正的uint8_t被髮揮時,所有東西都會爆炸。 – 2013-03-25 17:30:44
是否可以從書中的unpipc.h試圖定義stdint中定義的某些類型? – Digikata 2013-03-25 17:33:08