declare DYLD_LIBRARY_PATH in xCode
===

I'm trying to use this code to get my ImageMagick library in app bundle, but it's very complicated:

    -(id)init
    {
        if ([super init])
        {
            NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
            NSString* imageMagickPath = [bundlePath stringByAppendingPathComponent:@"/Contents/Resources/ImageMagick"];
            NSString* imageMagickLibraryPath = [imageMagickPath stringByAppendingPathComponent:@"/lib"];
    
            MAGICK_HOME = imageMagickPath;
            DYLD_LIBRARY_PATH = imageMagickLibraryPath;
        }
        return self;
    }
    
    -(void)composite
    {
        NSTask *task = [[NSTask alloc] init];
    
        // the ImageMagick library needs these two environment variables.
        NSMutableDictionary* environment = [[NSMutableDictionary alloc] init];
        [environment setValue:MAGICK_HOME forKey:@"MAGICK_HOME"];
        [environment setValue:DYLD_LIBRARY_PATH forKey:@"DYLD_LIBRARY_PATH"];
    
        // helper function from
        // http://www.karelia.com/cocoa_legacy/Foundation_Categories/NSFileManager__Get_.m
        NSString* pwd = [Helpers pathFromUserLibraryPath:@"MyApp"];
    
        // executable binary path
        NSString* exe = [MAGICK_HOME stringByAppendingPathComponent:@"/bin/composite"];
    
        [task setEnvironment:environment];
        [task setCurrentDirectoryPath:pwd]; // pwd
        [task setLaunchPath:exe]; // the path to composite binary
        // these are just example arguments
        [task setArguments:[NSArray arrayWithObjects: @"-gravity", @"center", @"stupid hat.png", @"IDR663.gif", @"bla.png", nil]];
        [task launch];
        [task waitUntilExit];
    }

But when I try to use it I am getting these errors:

1. Use of undeclared identifier 'MAGICK_HOME'
2. Use of undeclared identifier 'DYLD_LIBRARY_PATH'
3. Use of undeclared identifier 'MAGICK_HOME'
4. Use of undeclared identifier 'DYLD_LIBRARY_PATH'
5. Use of undeclared identifier 'MAGICK_HOME'

At:

1. `MAGICK_HOME = imageMagickPath;`
2. `DYLD_LIBRARY_PATH = imageMagickLibraryPath;`
3. `[environment setValue:MAGICK_HOME forKey:@"MAGICK_HOME"];`
4. `[environment setValue:DYLD_LIBRARY_PATH forKey:@"DYLD_LIBRARY_PATH"];`
5. `NSString* exe = [MAGICK_HOME stringByAppendingPathComponent:@"/bin/composite"];`

So how can I declare `DYLD_LIBRARY_PATH` and `MAGICK_HOME` identifiers?


  [1]: http://stackoverflow.com/questions/4773768/bundle-imagemagick-library-with-os-x-app
  [2]: http://stackoverflow.com/a/4792558/1428622