使用XCode编译时,具有相同类名的预期类名C ++

时间:2016-08-20 09:16:39

标签: c++ namespaces

我试图用XCode编译WebRTC(C ++)。最后也是唯一一个项目" webrtc"构建libwebtrc失败,错误:

/Volumes/Data/webrtc/webrtc/src/webrtc/audio/audio_receive_stream.h:33:49: Expected class name
/Volumes/Data/webrtc/webrtc/src/webrtc/audio/audio_receive_stream.h:36:28: No member named 'AudioReceiveStream' in namespace 'webrtc'; did you mean simply 'AudioReceiveStream'?

有两个名为" AudioReceiveStream"

的班级
- Class 1:  webrtc::AudioReceiveStream
- Class 2:  webrtc::internal::AudioReceiveStream


/*
 *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_AUDIO_RECEIVE_STREAM_H_
#define WEBRTC_AUDIO_RECEIVE_STREAM_H_

#include <map>
#include <memory>
#include <string>
#include <vector>

#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h"
#include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/transport.h"
#include "webrtc/typedefs.h"

namespace webrtc {
class AudioSinkInterface;

// WORK IN PROGRESS
// This class is under development and is not yet intended for for use outside
// of WebRtc/Libjingle. Please use the VoiceEngine API instead.
// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690

class AudioReceiveStream {
 public:
  struct Stats {
    uint32_t remote_ssrc = 0;
    int64_t bytes_rcvd = 0;
    uint32_t packets_rcvd = 0;
    uint32_t packets_lost = 0;
    float fraction_lost = 0.0f;
    std::string codec_name;
    uint32_t ext_seqnum = 0;
    uint32_t jitter_ms = 0;
    uint32_t jitter_buffer_ms = 0;
    uint32_t jitter_buffer_preferred_ms = 0;
    uint32_t delay_estimate_ms = 0;
    int32_t audio_level = -1;
    float expand_rate = 0.0f;
    float speech_expand_rate = 0.0f;
    float secondary_decoded_rate = 0.0f;
    float accelerate_rate = 0.0f;
    float preemptive_expand_rate = 0.0f;
    int32_t decoding_calls_to_silence_generator = 0;
    int32_t decoding_calls_to_neteq = 0;
    int32_t decoding_normal = 0;
    int32_t decoding_plc = 0;
    int32_t decoding_cng = 0;
    int32_t decoding_plc_cng = 0;
    int64_t capture_start_ntp_time_ms = 0;
  };

  struct Config {
    std::string ToString() const;

    // Receive-stream specific RTP settings.
    struct Rtp {
      std::string ToString() const;

      // Synchronization source (stream identifier) to be received.
      uint32_t remote_ssrc = 0;

      // Sender SSRC used for sending RTCP (such as receiver reports).
      uint32_t local_ssrc = 0;

      // Enable feedback for send side bandwidth estimation.
      // See
      // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions
      // for details.
      bool transport_cc = false;

      // See NackConfig for description.
      NackConfig nack;

      // RTP header extensions used for the received stream.
      std::vector<RtpExtension> extensions;
    } rtp;

    Transport* rtcp_send_transport = nullptr;

    // Underlying VoiceEngine handle, used to map AudioReceiveStream to lower-
    // level components.
    // TODO(solenberg): Remove when VoiceEngine channels are created outside
    // of Call.
    int voe_channel_id = -1;

    // Identifier for an A/V synchronization group. Empty string to disable.
    // TODO(pbos): Synchronize streams in a sync group, not just one video
    // stream to one audio stream. Tracked by issue webrtc:4762.
    std::string sync_group;

    // Decoders for every payload that we can receive. Call owns the
    // AudioDecoder instances once the Config is submitted to
    // Call::CreateReceiveStream().
    // TODO(solenberg): Use unique_ptr<> once our std lib fully supports C++11.
    std::map<uint8_t, AudioDecoder*> decoder_map;

    rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
  };

  // Starts stream activity.
  // When a stream is active, it can receive, process and deliver packets.
  virtual void Start() = 0;
  // Stops stream activity.
  // When a stream is stopped, it can't receive, process or deliver packets.
  virtual void Stop() = 0;

  virtual Stats GetStats() const = 0;

  // Sets an audio sink that receives unmixed audio from the receive stream.
  // Ownership of the sink is passed to the stream and can be used by the
  // caller to do lifetime management (i.e. when the sink's dtor is called).
  // Only one sink can be set and passing a null sink clears an existing one.
  // NOTE: Audio must still somehow be pulled through AudioTransport for audio
  // to stream through this sink. In practice, this happens if mixed audio
  // is being pulled+rendered and/or if audio is being pulled for the purposes
  // of feeding to the AEC.
  virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink) = 0;

  // Sets playback gain of the stream, applied when mixing, and thus after it
  // is potentially forwarded to any attached AudioSinkInterface implementation.
  virtual void SetGain(float gain) = 0;

 protected:
  virtual ~AudioReceiveStream() {}
};
}  // namespace webrtc

#endif  // WEBRTC_AUDIO_RECEIVE_STREAM_H_

第2课:

/*
 *  Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_
#define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_

#include <memory>

#include "webrtc/audio_receive_stream.h"
#include "webrtc/audio_state.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"

namespace webrtc {
class CongestionController;
class RemoteBitrateEstimator;
class RtcEventLog;

namespace voe {
class ChannelProxy;
}  // namespace voe

namespace internal {

class AudioReceiveStream final : public webrtc::AudioReceiveStream {
 public:
  AudioReceiveStream(CongestionController* congestion_controller,
                     const webrtc::AudioReceiveStream::Config& config,
                     const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
                     webrtc::RtcEventLog* event_log);
  ~AudioReceiveStream() override;

  // webrtc::AudioReceiveStream implementation.
  void Start() override;
  void Stop() override;
  webrtc::AudioReceiveStream::Stats GetStats() const override;
  void SetSink(std::unique_ptr<AudioSinkInterface> sink) override;
  void SetGain(float gain) override;

  void SignalNetworkState(NetworkState state);
  bool DeliverRtcp(const uint8_t* packet, size_t length);
  bool DeliverRtp(const uint8_t* packet,
                  size_t length,
                  const PacketTime& packet_time);
  const webrtc::AudioReceiveStream::Config& config() const;

 private:
  VoiceEngine* voice_engine() const;

  rtc::ThreadChecker thread_checker_;
  RemoteBitrateEstimator* remote_bitrate_estimator_ = nullptr;
  const webrtc::AudioReceiveStream::Config config_;
  rtc::scoped_refptr<webrtc::AudioState> audio_state_;
  std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
  std::unique_ptr<voe::ChannelProxy> channel_proxy_;

  RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream);
};
}  // namespace internal
}  // namespace webrtc

#endif  // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_

包含了webrtc :: AudioReceiveStream的标题,但仍然失败了。

如果我使用忍者来构建,则不会出现问题。代码未被修改。

XCode设置为: XCode settings

谢谢!

1 个答案:

答案 0 :(得分:0)

在XCode“Build Setting”中,搜索“USE_HEADERMAP”并设置为NO