【问题标题】:AudioKit 4.1 Mach-O Linker Error Swift 4AudioKit 4.1 Mach-O 链接器错误 Swift 4
【发布时间】:2018-03-09 10:38:09
【问题描述】:

我正在尝试学习使用 AudioKit 4.1 的基本教程。我首先在项目中导入了 AudioKit 框架,如下图所示。

导入AudioKit框架后,我在ViewController中添加了几行代码如下:

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.
}


}

运行代码时,我收到 59 错误,如下图所示。你是怎么解决的?

【问题讨论】:

    标签: ios swift4 audiokit


    【解决方案1】:

    从 4.1 版开始,AudioKit 现在作为静态框架提供。由于所有内部 C++ 代码,它都依赖于标准 C++ 库。这种依赖关系曾经由动态链接器自动解决,但现在不会了。

    消除这些错误的最简单方法是在 Xcode 的目标设置中添加 -lstdc++ 链接器标志(在“其他链接器标志”下)。

    【讨论】:

    • 注意:这记录在instructions on GitHub中。
    • 注意事项 :) 文档提到“-lc++”对我不起作用。只有添加“-lstdc++”才能为我完成这项工作。
    猜你喜欢
    • 1970-01-01
    • 2017-11-14
    • 1970-01-01
    • 2015-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2014-04-06
    相关资源
    最近更新 更多