Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AudioKit 4.1 Mach-O Linker Error Swift 4

I am trying to follow a basic tutorial using AudioKit 4.1. I first imported the AudioKit framework in the project as shown in the image below.

enter image description here

After importing the AudioKit framework, I added a few lines of code in the ViewController as follows:

import UIKit
import AudioKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    let oscillator = AKOscillator()
    oscillator.amplitude = 0.1
    AudioKit.output = oscillator
    oscillator.start()
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


}

Upon running the code, I got 59 error as shown in the image below. How do you fix it?

enter image description here

like image 466
Vince Gonzales Avatar asked Mar 09 '18 10:03

Vince Gonzales


1 Answers

Since version 4.1, AudioKit is now shipped as a static framework. Because of all the internal C++ code, it depends on the standard C++ library. This dependency used to be resolved automatically by the dynamic linker, but not any more.

The easiest way to make these errors go away is to simply add the -lstdc++ linker flag in your target settings in Xcode (under "Other Linker Flags").

like image 190
megastep Avatar answered Oct 16 '22 22:10

megastep