gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 05:44:17 24 4
gpt4 key购买 nike

我有一些代码想调用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com