Ok...I attempted to use a makefile, and received the following error.

$ make
Making all for tool Fraction...
 Linking tool Fraction ...
C:/GNUstep/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):
main.c:(.text+0x104): undefined reference to [EMAIL PROTECTED]'
collect2: ld returned 1 exit status
make[1]: *** [obj/Fraction.exe] Error 1
make: *** [Fraction.all.tool.variables] Error 2


The contents of my makefile are...

include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = Fraction
LogTest_OBJC_FILES = main.m

include $(GNUSTEP_MAKEFILES)/tool.make


My source is as follows...

#import <Foundation/Foundation.h>
#import <Foundation/NSObject.h>
#import <stdio.h>

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

-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(int) numerator;
-(int) denominator;
@end

@implementation Fraction

-(void) print {
        printf("%i/%i", numerator, denominator );
}

-(void) setNumerator: (int) n {
        numerator = n;
}

-(void) setDenominator: (int) d {
        denominator = d;
}

-(int) denominator {
        return denominator;
}

-(int) numerator {
        return numerator;
}

@end

int main( int argc, const char *argv[] ) {
    // create a new instance
    Fraction *frac = [[Fraction alloc] init];

    // set the values
    [frac setNumerator: 1];
    [frac setDenominator: 3];

    // print it
    printf( "The fraction is: " );
    [frac print];
    printf( "\n" );

    // free memory
    [frac release];

    return 0;
}


I attempted the example given in the Makefile link you supplied below and it
works perfectly so obviously I am doing something wrong.  Again, any help
would be greatly appreciated.

Thanks

On Fri, Feb 29, 2008 at 11:47 AM, Adam Fedor <[EMAIL PROTECTED]> wrote:

>
> On Feb 29, 2008, at 7:09 AM, Darin Bray wrote:
>
> > all of the pieces downloaded for GNUStep (for some reason the
> > Objective-C library is missing).  I ended up downloading the Core
> > and System Windows installers from the GNUStep website.  These
> > installed fine, and appear to have all the pieces.  However I am
> > still having issues compiling/linking programs.  I believe my
> > problem lies in the include directories for my headers and
> > libraries, possibly my different PATH variables.  Could someone who
> > is using this setup give me an example of their gcc command line to
> > build an application, as well as possibly your environment variables
> > I would greatly appreciate it.
>
> Don't try to call gcc directly - it's too hard.   Just use makefiles.
> See the tutorials here:
>
> http://www.gnustep.it/nicola/Tutorials/WritingMakefiles/
>
> also see docs here:
>
> http://www.gnustep.org/developers/documentation.html
>
>
>
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to