FreeBSD 6.0 and Objective C

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Nov 14 03:44:18 GMT 2005


On 2005-11-14 00:44, Marc Argent <margent at 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.



More information about the freebsd-questions mailing list