Need Help: Linking Error with Mail Plugin

  • Hi everyone,

    After quite a few years of inactivity, I'm pursuing my first Mac OS X
    development project in quite a while.  I'm writing a new Mail.app
    plugin, and I'm just trying to get started with the project work.

    Unfortunately, I'm not having much luck even building a simple
    "Hello, World" level bundle.  It seems I'm hitting a linking error.
    I'm pretty sure there is a trivial answer to this issue, but I can't
    seem to figure it out.

    Basically, my application has just a single class right now with two
    headers:

    MVMailBundle.h

    This file uses the class-dump to specify the interface for the
    MVMailBundle class which is implemented by Mail.app

    MyMailBundle.h

    This file defines a subclass of MVMailBundle, implementing only the
    class method:

    + (void)initialize;

    MyMailBundle.m

    This file implements initialize as follows:

    #import "MyMailBundle.h"

    @implementation MyMailBundle

    + (void) initialize
    {
    [super initialize];
    [self registerBundle];

    NSLog(@"My Mail Bundle has registered with Apple Mail!");
    }

    @end

    When I try to compile this project, it works just fine, but it dies
    with a linking error:

    /usr/bin/ld: Undefined symbols:
    .objc_class_name_MVMailBundle
    /Users/adamnash/Documents/Cocoa/AdamMail/build/AdamMail.build/Debug/
    MyMail.build/Objects-normal/ppc/MyMailBundle.o reference to
    undefined .objc_class_name_MVMailBundle
    collect2: ld returned 1 exit status

    This makes sense, of course, since I don't actually have the object
    code for Mail.app in my project.  I'm assuming there is some way to
    tell XCode to not look for this object code, but I'm not sure how to
    do this.  I've never tried to implement a sub-class for something
    that only exists in an active application.

    Can someone help me with this linking error?  I've been circling
    around it for over an hour with no luck.  I feel like I've looked at
    every possible project setting.

    Thank you!
    Adam

    -----------
    Adam Nash
    <adamnash...>
  • Hi everyone,

    Many thanks to Aaron Harnly for answering my question so quickly!

    From his email:

    There are two special settings you'll need in the 'Linking' section
    of the bundle target's configuration:

    1. in the field 'other linker flags', adding
    -undefined dynamic_lookup
    will resolve that issue.

    2. As with any bundle, set the Bundle Loader to
    /Applications/Mail.app/Contents/MacOS/Mail

    - Adam

    -----------
    Adam Nash
    <adamnash...>

    On Sep 15, 2007, at 4:39 PM, Adam Nash wrote:

    > Hi everyone,
    >
    > After quite a few years of inactivity, I'm pursuing my first Mac OS
    > X development project in quite a while.  I'm writing a new Mail.app
    > plugin, and I'm just trying to get started with the project work.
    >
    > Unfortunately, I'm not having much luck even building a simple
    > "Hello, World" level bundle.  It seems I'm hitting a linking
    > error.  I'm pretty sure there is a trivial answer to this issue,
    > but I can't seem to figure it out.
    >
    > Basically, my application has just a single class right now with
    > two headers:
    >
    > MVMailBundle.h
    >
    > This file uses the class-dump to specify the interface for the
    > MVMailBundle class which is implemented by Mail.app
    >
    > MyMailBundle.h
    >
    > This file defines a subclass of MVMailBundle, implementing only the
    > class method:
    >
    > + (void)initialize;
    >
    > MyMailBundle.m
    >
    > This file implements initialize as follows:
    >
    > #import "MyMailBundle.h"
    >
    > @implementation MyMailBundle
    >
    > + (void) initialize
    > {
    > [super initialize];
    > [self registerBundle];
    >
    > NSLog(@"My Mail Bundle has registered with Apple Mail!");
    > }
    >
    > @end
    >
    > When I try to compile this project, it works just fine, but it dies
    > with a linking error:
    >
    > /usr/bin/ld: Undefined symbols:
    > .objc_class_name_MVMailBundle
    > /Users/adamnash/Documents/Cocoa/AdamMail/build/AdamMail.build/Debug/
    > MyMail.build/Objects-normal/ppc/MyMailBundle.o reference to
    > undefined .objc_class_name_MVMailBundle
    > collect2: ld returned 1 exit status
    >
    > This makes sense, of course, since I don't actually have the object
    > code for Mail.app in my project.  I'm assuming there is some way to
    > tell XCode to not look for this object code, but I'm not sure how
    > to do this.  I've never tried to implement a sub-class for
    > something that only exists in an active application.
    >
    > Can someone help me with this linking error?  I've been circling
    > around it for over an hour with no luck.  I feel like I've looked
    > at every possible project setting.
    >
    > Thank you!
    > Adam
    >
    > -----------
    > Adam Nash
    > <adamnash...>
    >
    >
    >
    > _______________________________________________
    > MacOSX-dev mailing list
    > <MacOSX-dev...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev
    >
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today