From owner-freebsd-questions Sat Mar 8 2:57:13 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B827737B401 for ; Sat, 8 Mar 2003 02:57:11 -0800 (PST) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01.tampabay.rr.com [65.32.1.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9C3443F93 for ; Sat, 8 Mar 2003 02:57:10 -0800 (PST) (envelope-from ka0ttic@cfl.rr.com) Received: from ka0ttic (86.107.26.24.cfl.rr.com [24.26.107.86]) by ms-smtp-01.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h28Av914005022 for ; Sat, 8 Mar 2003 05:57:10 -0500 (EST) Subject: undefined reference to 'pthread_detach' From: Aaron Walker To: freebsd-questions@freebsd.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 08 Mar 2003 05:55:58 -0500 Message-Id: <1047120959.3805.4.camel@ka0ttic> Mime-Version: 1.0 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I was writing a little test threads program, and when I try to compile I get this: $gcc -o mttest mttest.c -lpthread /tmp/cco18ppz.o: In function `thread_func': /tmp/cco18ppz.o(.text+0xd2): undefined reference to `pthread_detach' I don't understand why I am getting this since pthread.h is included and I am including the library when compiling. the code is below.. any one have any ideas? here is the code: #include #include #include #include #define _REENTRANT #define _POSIX_SOURCE void * thread_func(void *); int main(int argc, char **argv) { int i, r, n, nthreads; pthread_t t; if(argc != 2) { fprintf(stderr, "argc != 2\n"); exit(1); } n = atoi(argv[1]); nthreads = 0; for(i=0;i