Search code examples
iosobjective-ccmtime

Undefined symbols for architecture i386: "_CMTimeMake", referenced from:


I don't understand why this is happening. I'm trying to us CMTimeMake:

CMTime cmTime = CMTimeMake(60, 1);

The imports of .h are:

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <AVFoundation/AVFoundation.h>

and .m are:

#import "ViewController.h"
#import "ContentView.h"
#import "AppDelegate.h"
#import "BackButton.h"
#import "NavButton.h"
#import "IIViewDeckController.h"
#import "TutorialView.h"

With a build error of:

Undefined symbols for architecture i386:
  "_CMTimeMake", referenced from:
      -[ViewController activateLockScreenPlayer:] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What am I missing?


Solution

  • You aren't linking with the CoreMedia framework. You can add it to your target in the project editor, like this:

    linking the framework