Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2005 00:44:53 +0000
From:      Marc Argent <margent@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   FreeBSD 6.0 and Objective C
Message-ID:  <4d6854f30511131644p52847154o@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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[])
{
=09printf("Hello World\n");
=09return 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'

I get the same error message from a vanilla install of FreeBSD 6.0 and
one that has been updated with all security updates as of Friday
(11/11/2005).  I realise that security updates wouldn't fix this, but
thought it worth mentioning.  Compiling the code without the "-l objc"
flag works just fine.

Any idea what is up?  I will try updating my other machine to the
latest and greatest sources tomorrow and see if that fixes it.

Regards

Marc



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