[Interest] OSX moc_file compile error

Jason H jhihn at gmx.com
Mon Feb 8 16:14:53 CET 2016


I'm building a modified version of Qt, I'm not used new to Objective-C. I have to include AVFoundation.h, because it has NSString key IDs, but when I do, the moc_ version of the file bombs out. How do I fix this?

In file included from .moc/debug/moc_avfaudioencodersettingscontrol.cpp:9:
In file included from .moc/debug/../../../../../../../../qt5/qtmultimedia/src/plugins/avfoundation/camera/avfaudioencodersettingscontrol.h:42:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:435:1: error: expected unqualified-id
@class NSString, Protocol;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:437:19: error: unknown type name 'NSString'; did you
      mean 'QString'?
FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);
                  ^
../../../../lib/QtMultimedia.framework/Headers/qaudioencodersettingscontrol.h:51:7: note: 'QString' declared here
class QString;
      ^
-----------
Here's the file (Minus comments)
#ifndef AVFAUDIOENCODERSETTINGSCONTROL_H
#define AVFAUDIOENCODERSETTINGSCONTROL_H

#include <qaudioencodersettingscontrol.h>
#include <MacTypes.h>

#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
#include <AVFoundation/AVFoundation.h>

QT_BEGIN_NAMESPACE

class AVFCameraSession;
class AVFCameraService;

class AVFAudioEncoderSettingsControl : public QAudioEncoderSettingsControl
{
    Q_OBJECT
public:
    explicit AVFAudioEncoderSettingsControl(AVFCameraService *service);

    QStringList supportedAudioCodecs() const Q_DECL_OVERRIDE;
    QString codecDescription(const QString &codecName) const Q_DECL_OVERRIDE;
    QList<int> supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
    QAudioEncoderSettings audioSettings() const Q_DECL_OVERRIDE;
    void setAudioSettings(const QAudioEncoderSettings &settings) Q_DECL_OVERRIDE;
    NSDictionary *settingsAsNSDictionary() const;
    FourCharCode codecAsFourCharCode(const QString &codec) const;

private:
    void initCodecs();

    AVFCameraSession *m_session;
    QAudioEncoderSettings m_settings;
    static QMap<QString, QString> *m_audioCodecs;
};

QT_END_NAMESPACE
-----------------



More information about the Interest mailing list