Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Nov 2005 19:43:42 -0800
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Marc Argent <margent@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD 6.0 and Objective C
Message-ID:  <20051114034342.GB6650@flame.pc>
In-Reply-To: <4d6854f30511131644p52847154o@mail.gmail.com>
References:  <4d6854f30511131644p52847154o@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-11-14 00:44, Marc Argent <margent@gmail.com> wrote:
> Hi,
>
> I am trying to compile a very simple Objective C program (actually, it
> is a 'Hello World' test program with a different file extension and
> linked to the Objective C library).
>
> #import <stdio.h>
>
> int main (int argc, const char *argv[])
> {
> 	printf("Hello World\n");
> 	return 0;
> }
>
> I am invoking the compiler with the following line:
>
> gcc main.m -o helloworld -l objc
>
> This results in the following error message:
>
> /usr/lib/libobjc.so: undefined reference to `pthread_attr_destroy'
> /usr/lib/libobjc.so: undefined reference to `pthread_create'
> /usr/lib/libobjc.so: undefined reference to `pthread_attr_init'
> /usr/lib/libobjc.so: undefined reference to `pthread_exit'
> /usr/lib/libobjc.so: undefined reference to `pthread_getschedparam'
> /usr/lib/libobjc.so: undefined reference to `pthread_setschedparam'
> /usr/lib/libobjc.so: undefined reference to `pthread_attr_setdetachstate'

First of all, remove the space after -l.

Then add -lpthread to the libraries you link to and see if that helps.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051114034342.GB6650>