23

I just compiled a project and Xcode returns these two errors which don't seem to be my code's fault. How do I fix them?

Undefined symbols for architecture i386:
  "_vImageBoxConvolve_ARGB8888", referenced from:
      -[UIImage(Blur) boxblurImageWithBlur:] in UIImage+Blur.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
kuranes
  • 546
  • 1
  • 6
  • 16
  • 1
    Care to show the related code? – Carl Norum Jul 01 '13 at 22:09
  • The problem is with the `UIImage+Blur.m` file. It's looking for a symbol named `vImageBoxConvolve_ARGB8888`. You need to include the .m (or .c) file that has this symbol. – rmaddy Jul 01 '13 at 22:39
  • Look at these links, they are very similar: http://stackoverflow.com/questions/22032987/how-to-solve-mach-o-linker-error-in-ios7-xcode-5-0-1 http://stackoverflow.com/questions/20073146/mach-o-linker-error-xcode-5 – user3817794 Jul 22 '14 at 15:52

3 Answers3

40

Teaching a man (or women) how to fish:

Usually Mach-O Linker Error means you have not included a header file for a function you are using in your code.

Easiest way is to copy that function or method call and paste into Xcode quick search using shift+command+O. This will search all frameworks (and header files), find that function or method call and show you its location (the header in this case):

In this case, this call belongs to the Accelerate framework so on top of your file, enter:

#import <Accelerate/Accelerate.h>

When doing quick search, you might have to get rid of leading underscore. In other words, search for vImageBoxConvolve_ARGB8888

Hope this helps

bdash
  • 18,110
  • 1
  • 59
  • 91
Khaled Barazi
  • 8,681
  • 6
  • 42
  • 62
  • 21
    This isn't accurate. Linker errors of this nature are most frequently due to failing to link against the framework or library that provides a symbol you're using. If you fail to `#include` or `#import` the necessary header you're much more likely to get a warning along the lines of `warning: implicit declaration of function 'vImageBoxConvolve_ARGB8888' is invalid in C99`. Adding the missing `#include` or `#import` will address the compiler warning, but does nothing to address the linker error. – bdash Jul 05 '13 at 00:48
  • 2
    This is a good way of finding out which framework you're missing though – Pete Apr 23 '14 at 09:07
  • I can't find out the missing library, can you please tell me how to find out which library is missing. – Anas Azeem Jul 08 '14 at 12:01
11

Google is your friend: someone else fixed this by adding the Accelerate framework to their project (and this does look like a framework error).

https://github.com/rnystrom/RNBlurModalView/issues/5

Make sure you also have the QuartzCore framework included as well, as that is also required by that library.

Xono
  • 1,900
  • 17
  • 20
  • It is not necessary to link against QuartzCore to use the Accelerate framework. – bdash Jul 05 '13 at 00:49
  • 1
    I didn't say it was. The library he's using - RNBlurModalView - requires both QuartzCore and Accelerate to function. Chances are good if one was left out, the other was too, so I added it as a note in my answer. – Xono Jul 05 '13 at 01:20
1

Apparently vImageBoxConvolve_ARGB8888() is not defined. See if the Accelerate framework is properly included in the project.

Rajan Twanabashu
  • 4,586
  • 5
  • 43
  • 55