Hi All. I'm trying to do some raw socket programming. I have some example code that compiles/run just fine on a 32 bit machine but when I try to compile the same code on a 64 bit machine I get this discrepancy between /usr/includes/sys and/usr/includes/linux header files. I would have thought that on a 64 bit machine all the headers are already "corrected" for 64 bit usage. Could someone please give me some pointers on how to resolve this issue. I'm using linux(fedora 9 64bit), GCC 4.3.2
Thanks!
I compile as follows: gcc -Wall -o server server.c and get the following errors:
In file included from /usr/include/sys/uio.h:24,
from /usr/include/sys/socket.h:28,
from server.c:4:
/usr/include/sys/types.h:46: error: conflicting types for ‘loff_t’
/usr/include/linux/types.h:30: error: previous declaration of ‘loff_t’ was here
/usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’
/usr/include/linux/types.h:13: error: previous declaration of ‘dev_t’ was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/sys/uio.h:24,
from /usr/include/sys/socket.h:28,
from server.c:4:
/usr/include/time.h:105: error: conflicting types for ‘timer_t’
/usr/include/linux/types.h:22: error: previous declaration of ‘timer_t’ was here
In file included from /usr/include/sys/uio.h:24,
from /usr/include/sys/socket.h:28,
from server.c:4:
/usr/include/sys/types.h:198: error: conflicting types for ‘int64_t’
/usr/include/linux/types.h:98: error: previous declaration of ‘int64_t’ was here
/usr/include/sys/types.h:204: error: conflicting types for ‘u_int64_t’
/usr/include/linux/types.h:97: error: previous declaration of ‘u_int64_t’ was here
In file included from /usr/include/sys/types.h:220,
from /usr/include/sys/uio.h:24,
from /usr/include/sys/socket.h:28,
from server.c:4:
/usr/include/sys/select.h:78: error: conflicting types for ‘fd_set’
/usr/include/linux/types.h:12: error: previous declaration of ‘fd_set’ was here
In file included from /usr/include/sys/uio.h:24,
from /usr/include/sys/socket.h:28,
from server.c:4:
/usr/include/sys/types.h:235: error: conflicting types for ‘blkcnt_t’
/usr/include/linux/types.h:124: error: previous declaration of ‘blkcnt_t’ was here
server.c: In function ‘main’:
server.c:45: warning: implicit declaration of function ‘htons’
server.c: In function ‘sigint’:
server.c:144: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’
server.c:145: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’