X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Date: Tue, 16 Nov 2021 14:55:05 +0000 X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1637074507; bh=mOaztt5ejPb6GzeItXZyW5TIYa0DUY2SNUgTwG2ys6Q=; h=Date:To:From:Reply-To:Subject:From; b=gyBvBGVV9kADHQHGvjSsQhD50MDuqnE92ASioV5Xgru1rnelLOpcTDmjmKZR/gvpu TfrqTyGUE+flwJb01TiQJw0fonsA90xVW2r2lmkYuojATYZnStJqaOrHLjG8nw5/vh RG/HB6hOO1Op+wyYyq+j+0IGvnfFg7t8d17LmUQo= To: "djgpp AT delorie DOT com" From: "gnufan42 (gnufan42 AT protonmail DOT com) [via djgpp AT delorie DOT com]" Subject: How to use pth207b.zip? Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Spam-Status: No, score=-0.7 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 1AGEtBZ5013768 Reply-To: djgpp AT delorie DOT com I must use pthread library to port a program to DOS. I'm using cygwin and I'm cross-compiling. The djgpp-gcc cygwin provided didn't come up with the library so I downloaded pth207b.zip. I'm sure I extracted the files to correct places. After I've done that I tried to compile a simple test program, but gcc said that it can't find sys/socket.h and it is included by pthread.h. I have no idea why on earth a thread library needs network but according to the FAQ (https://www.delorie.com/djgpp/v2faq/faq22_4.html). I chose WATTCP library and downloaded tcplib.zip. Then the gcc said that it can't find sys/wtime.h. I found that file in wat3222br2.zip so I copied wat3222br2.zip/net/watt/inc to /usr/i586-msdosdjgpp/include and wat3222br2.zip/net/watt/lib to /usr/i586-msdosdjgpp/lib. I thought that should solve the problem but no. The gcc popped up with a bunch of errors about redefinition and conflicting declaration. So what I did wrong? Thanks, Gnufan $ gcc ./pth_test.c In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:14:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/osdep.h:143:16: error: redefinition of ‘struct fd_set’ typedef struct fd_set { ^ In file included from /usr/i586-pc-msdosdjgpp/include/pthread.h:111:0, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/types.h:76:16: error: previous definition of ‘struct fd_set’ typedef struct fd_set { ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:14:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/osdep.h:145:3: error: conflicting declaration ‘typedef int fd_set’ } fd_set; ^ In file included from /usr/i586-pc-msdosdjgpp/include/pthread.h:111:0, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/types.h:78:3: note: previous declaration as ‘typedef struct fd_set fd_set’ } fd_set; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:35:22: error: conflicting declaration ‘typedef unsigned int word’ typedef unsigned int word; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:68:24: note: previous declaration as ‘typedef short unsigned int word’ typedef unsigned short word; /* 16 bits */ ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:43:3: error: conflicting declaration ‘typedef struct tcp_Socket tcp_Socket’ } tcp_Socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:277:3: note: previous declaration as ‘typedef struct _tcp_socket tcp_Socket’ } tcp_Socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:47:3: error: conflicting declaration ‘typedef struct udp_Socket udp_Socket’ } udp_Socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:211:3: note: previous declaration as ‘typedef struct _udp_socket udp_Socket’ } udp_Socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:49:0, from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/extsock.h:5:3: error: conflicting declaration ‘typedef union sock_type sock_type’ } sock_type; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:279:0, from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/extsock.h:5:3: note: previous declaration as ‘typedef union sock_type sock_type’ } sock_type; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:49:0, from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/extsock.h:17:3: error: conflicting declaration ‘typedef struct _ext_socket _ext_socket’ } _ext_socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:279:0, from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/extsock.h:17:3: note: previous declaration as ‘typedef struct _ext_socket _ext_socket’ } _ext_socket; ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:51:16: error: redefinition of ‘struct sockaddr_wat’ typedef struct sockaddr_wat { ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:310:16: error: previous definition of ‘struct sockaddr_wat’ typedef struct sockaddr_wat { ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:58:16: error: redefinition of ‘struct in_addr’ typedef struct in_addr { ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:9:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/sockaddr.h:19:8: error: previous definition of ‘struct in_addr’ struct in_addr { ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:73:18: error: ambiguating new declaration of ‘int sock_init()’ extern sock_init(); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:415:13: note: old declaration ‘void sock_init()’ extern void sock_init( void ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:112:31: error: ambiguating new declaration of ‘int isaddr(char*)’ extern int isaddr( char *text ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:378:13: note: old declaration ‘word isaddr(char*)’ extern word isaddr( char *string ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:238:23: error: ambiguating new declaration of ‘void _eth_init()’ extern void _eth_init(); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:321:13: note: old declaration ‘int _eth_init()’ extern int _eth_init( void ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:240:32: error: ambiguating new declaration of ‘void _eth_send(word)’ extern void _eth_send( word len); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:323:14: note: old declaration ‘int _eth_send(word)’ extern int _eth_send( word len); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:259:37: error: ambiguating new declaration of ‘char* psocket(tcp_Socket*)’ extern char *psocket( tcp_Socket *s ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:401:13: note: old declaration ‘void psocket(tcp_Socket*)’ extern void psocket( tcp_Socket *s ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:265:27: error: ambiguating new declaration of ‘longword gethostid()’ extern longword gethostid(); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/socket.h:12:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:113, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/sys/wattcp.h:407:6: note: old declaration ‘long int gethostid()’ long gethostid( void ); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:269:50: error: ambiguating new declaration of ‘char* gethostname(char*, int)’ extern char *gethostname( char *name, int length ); ^ In file included from /usr/i586-pc-msdosdjgpp/include/pthread.h:116:0, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/unistd.h:172:6: note: old declaration ‘int gethostname(char*, int)’ int gethostname(char *buf, int size); ^ In file included from /usr/i586-pc-msdosdjgpp/sys-include/sys/select.h:6:0, from /usr/i586-pc-msdosdjgpp/include/pthread.h:117, from pth_test.cpp:2: /usr/i586-pc-msdosdjgpp/sys-include/tcp.h:279:8: error: ‘_survivebootp’ does not name a type extern _survivebootp; ^ pth_test.cpp: In function ‘void* {anonymous}::start_routine(void*)’: pth_test.cpp:32:27: error: ‘nullptr’ was not declared in this scope void* no_status = nullptr; ^ pth_test.cpp: In function ‘bool a11c()’: pth_test.cpp:80:27: error: ‘nullptr’ was not declared in this scope { void* no_status = nullptr; ^