簡體   English   中英

Xcode 需要哪些設置才能構建此代碼

[英]What settings are needed in Xcode to get this code to build

讓我們看看這個代碼,它位於 header 文件中。 項目本身是 Objective-C++(.h &.mm 文件)。

這看起來像是 C++ 和 Objective-C 的混合體。 根據我的閱讀,為了將 Objective-C++ 與 Objective-C 混合,您必須將所有 C++ 內容保留在 header 文件之外,但這不是案例。

該項目構建良好,但是我無法在新項目中復制它(通過復制相同的代碼)。

Xcode 需要哪些設置才能構建? 已經比較了項目構建設置,它們是相同的。

這些錯誤與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

有關錯誤的一些詳細信息:

在此處輸入圖像描述

我假設您只是#include / #import來自.mm文件的 header 。

默認結構字段值是 C++11 的新功能。 新項目中的 C++ 標准可能設置為 C++98 嗎?

我不是 100% 確定細節,但也許一些更復雜的默認值表達式只有在更新版本的 C++ 中才有可能。 所以建議你嘗試在項目中更改C++標准版,看看有沒有效果。

Xcode 中的 C++ 語言方言設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM