help-gnustep
[Top][All Lists]
Advanced

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

Re: NSObject errors compiling Objective-C programs


From: Richard Frith-Macdonald
Subject: Re: NSObject errors compiling Objective-C programs
Date: Mon, 10 Oct 2005 07:28:01 +0000

On 2005-10-10 06:41:02 +0000 Mehul N. Sanghvi <mehul.sanghvi@gmail.com> wrote:


OK, so I've got gnustep-base and gnustep-make installed.  I'm trying to
follow the code as given on the "Objective-C for Beginners" website which is refrenced from the gnustep.org website.

I am getting the following error when I try to compile the simple
fractions example:

prompt% make
Making all for objc_program fraction_driver...
Compiling file fraction_driver.m ...
Compiling file fraction.m ...
Linking objc_program fraction_driver ...
../shared_obj/fraction.o(.data.rel+0xf4): undefined reference to `__objc_class_name_NSObject'
collect2: ld returned 1 exit status
make[1]: *** [shared_obj/fraction_driver] Error 1
make: *** [fraction_driver.all.objc-program.variables] Error 2


What am I doing wrong ?  I'm just trying to compile a simple
Objective-C program, using the GNUstep make system.

You are building a standalone program which doesn't use the GNUstep base library ... as such, you can't have it usse anything in the base library (such as NSObject).

This is probably not what you want.

I guess you want to build a command-line tool using the base library ... for that your makefile needs to use TOOL_NAME rather than OBJC_PROGRAM_NAME, and include tool.make rather than objc.make


cheers,

     mehul


---- begin header file ----
#import <Foundation/Foundation.h>

@interface Fraction: NSObject
{
  int numerator;
  int denominator;
}

/* rest of code snipped */
---- end header file ----


==== GNUmakefile ====
include $(GNUSTEP_MAKEFILES)/common.make

# Space seperated list of executables to be built OBJC_PROGRAM_NAME = fraction_driver

fraction_driver_OBJC_FILES = fraction_driver.m fraction.m

include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/objc.make
==== GNUmakefile ends ====


~~~~ GNUmakefile.preamble ~~~~~
ADDITIONAL_OBJCFLAGS += -Wall -Wno-import #-fnext-runtime ~~~~ GNUmakefile.preamble ~~~~~









reply via email to

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