我正在使用GPUImage进行图像过滤,我将GPUImage完美地集成到了我的项目中,现在我想将GPUImage文件访问到我的代码中。我收到了链接器错误。

当我在ViewController中使用此代码时

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    GPUImageFilter *selectedFilter;

    switch (buttonIndex) {
        case 0:
            selectedFilter = [[GPUImageGrayscaleFilter alloc] init];
            break;
        case 1:
            selectedFilter = [[GPUImageSepiaFilter alloc] init];
            break;
        case 2:
            selectedFilter = [[GPUImageSketchFilter alloc] init];
            break;
        case 3:
            selectedFilter = [[GPUImagePixellateFilter alloc] init];
            break;
        case 4:
            selectedFilter = [[GPUImageColorInvertFilter alloc] init];
            break;
        case 5:
            selectedFilter = [[GPUImageToonFilter alloc] init];
            break;
        case 6:
            selectedFilter = [[GPUImagePinchDistortionFilter alloc] init];
            break;
        case 7:
            selectedFilter = [[GPUImageFilter alloc] init];
            break;
        default:
            break;
    }

    UIImage *filteredImage = [selectedFilter imageByFilteringImage:self.imgViewPhoto.image];
    [self.imgViewPhoto setImage:filteredImage];
}

如何解决这个问题?等待答案。

最佳答案

GPUImage框架未添加到项目目标。

Adding the framework to your iOS project

Start by dragging the GPUImage.xcodeproj file into your application's Xcode project to embed the framework in your project.
Next, go to your application's target and add GPUImage as a Target Dependency.
Finally, you'll want to drag the libGPUImage.a library from the GPUImage framework's Products folder to the Link Binary With Libraries build phase in your application's target.

当然是:#import "GPUImage.h"

关于iphone - 使用GPUImage时如何解决i386链接器体系结构错误?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18739212/

10-11 07:06