help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link to C++ library


From: Pascal Bourguignon
Subject: Re: Link to C++ library
Date: Tue, 10 Sep 2002 23:28:28 +0200 (CEST)

> From: "Yen-Ju Chen" <yjchenx@hotmail.com>
> Date: Tue, 10 Sep 2002 16:55:52 -0400
> 
> 
>   Thanx a lot. It helps.
>   But can I directly link Objective-C to C++ throught
>   the C interface which the C++ library offers ?
> 
>   After apply the CC=g++, the error message becomes
> 
>   .../libgnustep-base.so: undefined reference to '__objc_msg_forward'
>   .../libgnustep-base.so: undefined reference to '__objc_msg_thread_add'
>   .../libgnustep-base.so: undefined reference to '__objc_msg_thread_remove'
> 
>   Or do I need to write a C library as the bridge between Objective-C and 
> C++ ?

You seem to be missing the  Objective-C runtime. I still use a GNUstep
some months old,  but it's makefiles automatically cite  -lobjc on the
link line.  I have something like:

 g++ -rdynamic \
      -o MyApp.app/ix86/linux-gnu/gnu-gnu-gnu/MyApp \
      shared_obj/ix86/linux-gnu/gnu-gnu-gnu/MyObjects.o ... \
      -L/home/pascal/GNUstep/Libraries/ix86/linux-gnu/gnu-gnu-gnu \
      -L/home/pascal/GNUstep/Libraries/ix86/linux-gnu \
      -L/local/gnustep/Local/Libraries/ix86/linux-gnu/gnu-gnu-gnu \
      -L/local/gnustep/Local/Libraries/ix86/linux-gnu \
      -L/local/gnustep/Network/Libraries/ix86/linux-gnu/gnu-gnu-gnu \
      -L/local/gnustep/Network/Libraries/ix86/linux-gnu \
      -L/local/gnustep/System/Libraries/ix86/linux-gnu/gnu-gnu-gnu \
      -L/local/gnustep/System/Libraries/ix86/linux-gnu \
      -L/local/gnustep/System/Libraries/ix86/linux-gnu \
      -lgnustep-gui -lgnustep-base -lobjc \
      -lz -lcallback -lavcall -lxml2 -lz -lm -lgmp -lpthread -ldl -lm \
      $(MyApp_OTHER_LIBRARIES)


>   Thanx again.
> 
>   Yen-Ju
> 
> >From: Pascal Bourguignon <pjb@informatimago.com>
> >Date: Tue, 10 Sep 2002 22:38:13 +0200 (CEST)
> > > From: "Yen-Ju Chen" <yjchenx@hotmail.com>
> > > Date: Tue, 10 Sep 2002 15:52:52 -0400
> > >
> > >   I try to use the id3lib (http://www.id3lib.org), which is a
> > >   C++ library, but offer the C interface.  But I met a problem
> > >   about linking between id3lib and standard C++  library.  Is it
> > >   possible to use such C++ library with C interface in GNUstep ?
> >
> >I  do  link  routinely   C++  libraries  into  GNUstep  /  Objective-C
> >applications without any problem, passing thru a C interface.
> >
> >Here  is an example  of GNUmakefile  I used  lately. The  only notable
> >thing  is  the  use  of  the  g++ compiler  (CC=g++)  to  compile  the
> >MyCppLibCalls.c  file, which  contains  only simple  C functions  each
> >sending  a message  to a  C++ object  from libMyCppLib.a,  which  is a
> >library of C++ objects.


-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
 The name is Baud,...... James Baud.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]