Expected class or namespace

I am getting compile time for enum in C ++, error says expected class or namespace

  mf.setStatus(MediaFile::SyncStatus::Synced);

      

An enumeration is defined as follows

 class MediaFile
 {
    public:
    enum SyncStatus 
    {
        New = 0,
        Remove = 5,
        Synced = 10,
        Unknown = 15
    };

    //...
 };

      

I am compiling in xcode, but I am guessing it has to do with the C ++ syntax previously compiled in Visual Studio. Visual studio has probably given some warnings about this, but did the build Any suggestions please?

+3


source to share


2 answers


Try it MediaFile::Synced

. SyncStatus

is a type name (as in SyncStatus theStatus

), not a namespace.



+9


source


enum

in C ++ they don't define a namespace, so the enumerator values ​​go into the surrounding context. You need to do MediaFile::Synced

.



+4


source







All Articles