c++ - 不能在 iOS C++ 代码中包含 Accelerate Header

标签 c++ ios accelerate-framework

我有一些代码想调用 vDSP。 这是 Xcode 项目中的 C++ 文件。主要项目在 Objective C 中。 每当我这样做

#include <Accelerate/Accelerate.h>  

它给了我很多错误。

#if defined(__cplusplus)
#pragma once

#include <Accelerate/Accelerate.h> // <-- error
#include "oscillator.h"


namespace synth {
class CQBLimitedOscillator : public COscillator
{
    float dOuts[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
public:
    CQBLimitedOscillator(void);
    ~CQBLimitedOscillator(void);

    // --- init globals
    inline virtual void initGlobalParameters(globalOscillatorParams* pGlobalOscParams)
    {
        // --- always call base class first to store pointer
        COscillator::initGlobalParameters(pGlobalOscParams);

        // --- add any QBL specifics here
    }

    // -- parallel proqcess 4 sawteeth
    inline void doSawTeeth(float* dOutsIn, float dModulo, float dInc) {

        float scalar2Val = 2.0f;
        float scalar1Val = -1.0f;

        // -- 2.0f*dValue - 1.0f
        vDSP_vsmsa(dOutsIn, 1, &scalar2Val, &scalar1Val, dOutsIn, 1, 4);

    }

Errors

最佳答案

oscillator.h 中包含的文件之一是这样的:

#include "math.h"

将其更改为

#include <cmath>

成功了。 Accelerate 也以这种方式 (cmath) 使用数学库。

关于c++ - 不能在 iOS C++ 代码中包含 Accelerate Header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29875353/

相关文章:

c - {{a,b,c},{d,e,f}} 和 {{g,h,i},{j,k,i},{l,m,n}} 卷积的 ListCorrelate vDSP 等价物

iphone - 使用 Apple FFT 和 Accelerate 框架

iOS - 解析加速框架时出错

c++ - 哪个是 C++ 中迭代大量元素最快的 STL 数据结构?

c++ - 在命名空间中转发定义类?

c++ - Eclipse Indigo CDT 代码完成

ios - 哪些字体可以保证在 iOS 设备上可用?

ios - Swift- 按类型访问枚举

c++ - 这是赋值运算符错误吗?

javascript - React-Native 应用程序上的 AppLock 功能