help-gnustep
[Top][All Lists]
Advanced

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

Re: Link to C++ library


From: Yen-Ju Chen
Subject: Re: Link to C++ library
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++ ?

 Thanx again.

 Yen-Ju

From: Pascal Bourguignon <pjb@informatimago.com>
Reply-To: <pjb@informatimago.com>
To: yjchenx@hotmail.com
CC: help-gnustep@gnu.org
Subject: Re: Link to C++ library
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
>
> Hi,
>
>   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 ?
>
>   Yen-Ju


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.

------------------------------------------------------------------------
include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/common.make
#GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)
GNUSTEP_INSTALLATION_DIR=$(INSTALLDIR)

OBJCFLAGS += -g -Wall -DUNIX #-DSTRICT_OPENSTEP
CFLAGS    += -g -Wall -DUNIX #-DSTRICT_OPENSTEP
# (For now, the compilation on GNUstep with STRICT_OPENSTEP is broken).

ADDITIONAL_INCLUDE_DIRS = \
        -I. \
        -IUtilities.subproj \
        -I$(INSTALLDIR) \
        -I$(INSTALLDIR)/MyCppLib/interfaces

CC=g++

-include GNUmakefile.preamble


SUBPROJECTS=\
        Utilities.subproj

include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/aggregate.make


APP_NAME=YyyyTest
YyyyTest_PRINCIPAL_CLASS=YyyyTest
YyyyTest_APPLICATION_ICON=icon.tiff
YyyyTest_RESOURCE_FILES=$(YyyyTest_APPLICATION_ICON)
YyyyTest_RESOURCE_DIRS=
YyyyTest_SUBPROJECTS=$(SUBPROJECTS)
YyyyTest_OTHER_LIBRARIES=\
        $(INSTALLDIR)/MyCppLib/libraries/libMyCppLib.a \
        /usr/lib/libmcheck.a
YyyyTest_TOOL_LIBS=$(YyyyTest_OTHER_LIBRARIES)
YyyyTest_LIB_DIRS=
YyyyTest_C_FILES=\
        MyCppLibCalls.c
YyyyTest_OBJC_FILES=\
        YyyyTest_main.m \
        YyyyTest.m \
        YyyyCLog.m \
        YyyyCTree.m \
        YyyyVTree.m \
        YyyyDictionary.m \
        YyyyObject.m \
                YyyyLogToCallBack.m \
                YyyyFileDS.m \
                YyyyReference.m \
                YyyyElement.m \
                YyyyTree.m


include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/application.make

-include GNUmakefile.postamble

#END#
------------------------------------------------------------------------

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




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx





reply via email to

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