public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* newbie of Obj-C
@ 2002-06-28 23:48 benbondu
  2002-06-29  5:15 ` bjorn rohde jensen
  0 siblings, 1 reply; 2+ messages in thread
From: benbondu @ 2002-06-28 23:48 UTC (permalink / raw)
  To: gcc-help

I'm trying to learn Objective-C but can't seem to get a simple program to compile.  I copied it from a college web site so I assume it's written correctly.  After compiling each implementation file like this:

gcc -c -Wno-import (.m file)


I then try to link all of the implementations like this:

gcc -Wno-import (.o files) -lobjc


but instead of an a.out I get this:


/usr/lib/gcc-lib/i386-linux/2.95.2/libobjc.a(thr-posix.o): In function `__objc_init_thread_system':
thr-posix.o(.text+0x41): undefined reference to `pthread_key_create'
/usr/lib/gcc-lib/i386-linux/2.95.2/libobjc.a(thr-posix.o): In function `__objc_thread_detach':
thr-posix.o(.text+0x79): undefined reference to `pthread_create'
/usr/lib/gcc-lib/i386-linux/2.95.2/libobjc.a(thr-posix.o): In function `__objc_thread_set_data':
thr-posix.o(.text+0x128): undefined reference to `pthread_setspecific'
/usr/lib/gcc-lib/i386-linux/2.95.2/libobjc.a(thr-posix.o): In function `__objc_thread_get_data':
thr-posix.o(.text+0x148): undefined reference to `pthread_getspecific'
/usr/lib/gcc-lib/i386-linux/2.95.2/libobjc.a(thr-posix.o): In function `__objc_mutex_trylock':
thr-posix.o(.text+0x235): undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status


Now I've done some simple C and C++ programming on this machine before (no problem compiling them) but I have no idea what these errors are about.  I'm running Debian 2.2R6 and installed the Objective-C development packages but I suspect I still may not have everything set up right.  Much appreciation for anyone who can guide me in the right direction toward getting this to work.  Thanks

Ben



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: newbie of Obj-C
  2002-06-28 23:48 newbie of Obj-C benbondu
@ 2002-06-29  5:15 ` bjorn rohde jensen
  0 siblings, 0 replies; 2+ messages in thread
From: bjorn rohde jensen @ 2002-06-29  5:15 UTC (permalink / raw)
  To: benbondu; +Cc: gcc-help

Hi Ben,

 It looks like, you need to link with the pthread
library. The code appears to be multi threaded, which
is sort of a complicated way to start learning a language.

Try to add -lpthread to your link stage.

Yours sincerely,

Bjorn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-29 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-28 23:48 newbie of Obj-C benbondu
2002-06-29  5:15 ` bjorn rohde jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).