Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:57:18+00:00 2026-06-09T23:57:18+00:00

I am attempting to implement the AVFoundation example code found here in an Xcode

  • 0

I am attempting to implement the AVFoundation example code found here in an Xcode project: http://developer.apple.com/library/mac/#qa/qa1740/_index.html#//apple_ref/doc/uid/DTS40011007

The only modifications I have made were to remove references to autorelease, release, and retain because I have automatic reference counting enabled for the project. Having successfully resolved those build errors, I am now getting “Undefined symbols for architecture x86_64”.

I am running on Mountain Lion 10.8, and get no errors when importing AVFoundation.h into my headers file, but it seems like the AV* symbols are not being found?

Below is the error log, .h, and .m code. Could someone more knowledgable help me identify where the issue(s) lie?

Log:

Undefined symbols for architecture x86_64:
  "_AVCaptureSessionPresetMedium", referenced from:
      -[Recorder screenRecording:] in screenAppDelegate.o
  "_OBJC_CLASS_$_AVCaptureMovieFileOutput", referenced from:
      objc-class-ref in screenAppDelegate.o
  "_OBJC_CLASS_$_AVCaptureScreenInput", referenced from:
      objc-class-ref in screenAppDelegate.o
  "_OBJC_CLASS_$_AVCaptureSession", referenced from:
      objc-class-ref in screenAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

.h

#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

@interface screenAppDelegate : NSObject <NSApplicationDelegate>
@end

@interface Recorder : NSObject <AVCaptureFileOutputRecordingDelegate> {
    @private AVCaptureSession *mSession;
    AVCaptureMovieFileOutput *mMovieFileOutput;
    NSTimer *mTimer;
}

-(void)screenRecording:(NSURL *)destPath;

@end

.m

#import "screenAppDelegate.h"

@implementation screenAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
}

@end


@implementation Recorder

-(void)screenRecording:(NSURL *)destPath 
{
    // Create a capture session
    mSession = [[AVCaptureSession alloc] init];

    // Set the session preset as you wish
    mSession.sessionPreset = AVCaptureSessionPresetMedium;

    // If you're on a multi-display system and you want to capture a secondary display,
    // you can call CGGetActiveDisplayList() to get the list of all active displays.
    // For this example, we just specify the main display.
    CGDirectDisplayID displayId = kCGDirectMainDisplay;

    // Create a ScreenInput with the display and add it to the session
    AVCaptureScreenInput *input = [[AVCaptureScreenInput alloc] initWithDisplayID:displayId];
    if (!input) {
        //[mSession release];
        mSession = nil;
        return;
    }
    if ([mSession canAddInput:input])
        [mSession addInput:input];

    // Create a MovieFileOutput and add it to the session
    mMovieFileOutput = [[AVCaptureMovieFileOutput alloc] init];
    if ([mSession canAddOutput:mMovieFileOutput])
        [mSession addOutput:mMovieFileOutput];

    // Start running the session
    [mSession startRunning];

    // Delete any existing movie file first
    if ([[NSFileManager defaultManager] fileExistsAtPath:[destPath path]])
    {
        NSError *err;
        if (![[NSFileManager defaultManager] removeItemAtPath:[destPath path] error:&err])
        {
            NSLog(@"Error deleting existing movie %@",[err localizedDescription]);
        }
    }

    // Start recording to the destination movie file
    // The destination path is assumed to end with ".mov", for example, @"/users/master/desktop/capture.mov"
    // Set the recording delegate to self
    [mMovieFileOutput startRecordingToOutputFileURL:destPath recordingDelegate:self];

    // Fire a timer in 5 seconds
    mTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(finishRecord:) userInfo:nil repeats:NO];
}

-(void)finishRecord:(NSTimer *)timer
{
    // Stop recording to the destination movie file
    [mMovieFileOutput stopRecording];

    //[mTimer release];
    mTimer = nil;
}

// AVCaptureFileOutputRecordingDelegate methods

- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error
{
    NSLog(@"Did finish recording to %@ due to error %@", [outputFileURL description], [error description]);

    // Stop running the session
    [mSession stopRunning];

    // Release the session
    //[mSession release];
    mSession = nil;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:57:20+00:00Added an answer on June 9, 2026 at 11:57 pm

    It’s not enough to import header files, you also have to add the AVFoundation framework to your project. This error comes from the linker, not from the compiler itself – the AVFoundation headers could be found and the compilation of your source files was successful, but the linker couldn’t make an executable out of the resulting object files as you haven’t told it (through Xcode’s settings) to link against the AVFoundation framework.

    See this article on the compilation process to understand why this happens.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to implement the MSDN example (http://msdn.microsoft.com/en-us/library/swx5easy.aspx) for Thread.Timers in my own code.
I am attempting to implement the jQuery Tools Scrollable Example from here: http://flowplayer.org/tools/scrollable/index.html and
I'm attempting to implement the technique for data validation from Josh Smith's example here:
I am attempting to implement a tagging system into my asp.net MVC project. When
I'm attempting to implement a phpBB library into Kohana. I have created a vendor
I'm attempting to implement a MVP pattern in my latest project. Currently using the
Is anyone attempting to implement C# for the JVM? As a Java developer, I've
I am attempting to implement an HTTP tunnel using similar techniques to those employed
I am attempting to implement command-line options into my code. For some reason, my
I'm attempting to implement the atomic library from the C++0x draft. Specifically, I'm implementing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.