On NCR 4.3.03 conflict at compile time using gcc 2.95.3

Brother Tuck brothertuck72@hotmail.com
Wed Apr 4 09:11:00 GMT 2001


Hi,
I have built successfully the gcc 2.95.3 on NCR 4.3.03.
But when I try to compile a part of my project using this fresh 
installation.
I got an error at compile time for severals function, for me:
- htons(..)
- ntohs(..)
At the beginning I believed that the problem coming from the binutils 
package so I have recompile the gcc usin native as, linker...
And I got the same error.

-------------------------- m_test.cpp
#include <netinet/in.h>

#ifndef __M_TEST_NO_ARPA
#include <arpa/inet.h>
#endif

#define DEST_IP   "127.0.0.1"
#define DEST_PORT 23

void    main(void) {
struct sockaddr_in dest_addr;

dest_addr.sin_port = htons(DEST_PORT);
dest_addr.sin_addr.s_addr = inet_addr(DEST_IP);
}
--------------------------- end of m_test.cpp

When I try to compile including the header inet.h for the system
=================================================
bash-2.02$ c++ -o m_test m_test.cpp
In file included from m_test.cpp:2:
/usr/include/arpa/inet.h:67: declaration of C function `in_port_t 
htons(short unsigned int)' conflicts with
/usr/local/gcc/2.95.3/lib/gcc-lib/i586-ncr-sysv4.3.03/2.95.3/include/sys/byteorder.h:60: 
previous declaration `short unsigned int htons(unsigned int)' here
/usr/include/arpa/inet.h:69: declaration of C function `in_port_t 
ntohs(short unsigned int)' conflicts with
/usr/local/gcc/2.95.3/lib/gcc-lib/i586-ncr-sysv4.3.03/2.95.3/include/sys/byteorder.h:140: 
previous declaration `short unsigned int ntohs(unsigned int)' here

If I compile without the header inet.h
============================
bash-2.02$ c++ -D__M_TEST_NO_ARPA -o m_test m_test.cpp
m_test.cpp: In function `int main(...)':
m_test.cpp:14: implicit declaration of function `int inet_addr(...)'

I have also try to give the path to the system include (It's not a good 
idea...)
=======================================================
bash-2.02$ gcc -o m_test m_test.c -I/usr/include
In file included from /usr/include/sys/endian.h:37,
                 from /usr/include/netinet/in.h:58,
                 from m_test.c:1:
/usr/include/sys/byteorder.h:87: parse error before `unsigned'
m_test.c: In function `main':
m_test.c:10: warning: return type of `main' is not `int'
bash-2.02$ gcc -o m_test m_test.c -I/usr/include
bash-2.02$ mv m_test.c m_test.cpp
bash-2.02$ gcc -o m_test m_test.cpp -I/usr/include
In file included from /usr/include/sys/endian.h:37,
                 from /usr/include/netinet/in.h:58,
                 from m_test.cpp:1:
/usr/include/sys/byteorder.h:87: parse error before `unsigned'
/usr/include/sys/byteorder.h:90: syntax error before `,'
/usr/include/sys/byteorder.h:110: syntax error before `,'
/usr/include/sys/byteorder.h:135: syntax error before `,'
/usr/include/sys/byteorder.h:139: syntax error before `,'
/usr/include/sys/byteorder.h:143: syntax error before `%'
/usr/include/sys/byteorder.h:167: syntax error before `,'
/usr/include/sys/byteorder.h:171: syntax error before `,'
/usr/include/sys/byteorder.h:175: syntax error before `%'


If someone can help me...

Regards,
Emmanuel Soden

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .



More information about the Gcc mailing list