gpt4 book ai didi

c++ - Xcode需要哪些设置才能构建此代码

转载 作者:行者123 更新时间:2023-12-01 14:52:08 25 4
gpt4 key购买 nike

让我们看一下位于头文件中的这段代码。该项目本身是Objective-C++(。h和.mm文件)。
这看起来像是C++和Objective-C的混合体。根据我的阅读,为了将Objective-C++与Objective-C混合使用,您必须将所有C++内容保留在头文件之外,但是事实并非如此。
该项目构建良好,但是我不能在新项目中复制它(通过复制相同的代码)。
Xcode需要哪些设置才能构建它?已经比较了项目构 build 置,它们是相同的。
错误与Options结构中的内联初始化程序有关。

/*
This file is part of the Structure SDK.
Copyright © 2019 Occipital, Inc. All rights reserved.
http://structure.io
*/

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

#import <Structure/Structure.h>
#import <Structure/STCaptureSession.h>

#import "CalibrationOverlay.h"
#import "MeshViewController.h"
#import "SettingsPopupView.h"

// See default initialization in: -(void)initializeDynamicOptions
struct DynamicOptions
{
bool depthAndColorTrackerIsOn;
bool improvedTrackingIsOn;
bool highResColoring;
bool improvedMapperIsOn;
bool highResMapping;
STCaptureSessionPreset depthStreamPreset;
};

struct Options
{
// The initial scanning volume size will be 0.5 x 0.5 x 0.5 meters
// (X is left-right, Y is up-down, Z is forward-back)
const GLKVector3 initVolumeSizeInMeters = GLKVector3Make (0.5f, 0.5f, 0.5f);

// The maximum number of keyframes saved in keyFrameManager
int maxNumKeyFrames = 48;

// Colorizer quality
STColorizerQuality colorizerQuality = STColorizerHighQuality;

// Take a new keyframe in the rotation difference is higher than 20 degrees.
float maxKeyFrameRotation = 20.0f * (M_PI / 180.f); // 20 degrees

// Take a new keyframe if the translation difference is higher than 30 cm.
float maxKeyFrameTranslation = 0.3; // 30cm

// Threshold to consider that the rotation motion was small enough for a frame to be accepted
// as a keyframe. This avoids capturing keyframes with strong motion blur / rolling shutter.
float maxKeyframeRotationSpeedInDegreesPerSecond = 1.f;

// Whether we should use depth aligned to the color viewpoint when Structure Sensor was calibrated.
// This setting may get overwritten to false if no color camera can be used.
bool useHardwareRegisteredDepth = false;

// Whether to enable an expensive per-frame depth accuracy refinement.
// Note: this option requires useHardwareRegisteredDepth to be set to false.
const bool applyExpensiveCorrectionToDepth = true;

// Whether the colorizer should try harder to preserve appearance of the first keyframe.
// Recommended for face scans.
bool prioritizeFirstFrameColor = true;

// Target number of faces of the final textured mesh.
int colorizerTargetNumFaces = 50000;

// Focus position for the color camera (between 0 and 1). Must remain fixed one depth streaming
// has started when using hardware registered depth.
const float lensPosition = 0.75f;
};

...
@interface ViewController : UIViewController <STBackgroundTaskDelegate, MeshViewDelegate, AVCaptureVideoDataOutputSampleBufferDelegate, UIPopoverControllerDelegate, UIGestureRecognizerDelegate, SettingsPopupViewDelegate>
{
...
}
@end
有关错误的一些详细信息:
enter image description here

最佳答案

我假设您只是#include / #import.mm文件中使用此 header 。
默认的struct字段值是C++ 11的新功能。新项目中的C++标准是否可能设置为C++ 98?
我不确定100%的细节,但是也许某些更复杂的默认值表达式只能在更新版本的C++中使用。因此,我建议您尝试在项目中更改C++标准版本,看看它是否有效果。
C++ language dialect setting in Xcode

关于c++ - Xcode需要哪些设置才能构建此代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62693455/

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