0

I am receiving the following two errors, and I don’t know how to fix the code in the ut_unixTimer.h header file.

In file included from xap_CocoaTimer.cpp:28:

../../../../src/af/util/unix/ut_unixTimer.h:34:16: error: redefinition of 'NSMutableDictionary' as different kind of symbol typedef struct NSMutableDictionary; ^ /System/Library/Frameworks/AppKit.framework/Headers/NSPageController.h:16:8: note: previous definition is here @class NSMutableDictionary, NSView; ^

In file included from xap_CocoaTimer.cpp:28:

../../../../src/af/util/unix/ut_unixTimer.h:35:16: error: redefinition of 'NSLock' as different kind of symbol typedef struct NSLock; ^ /System/Library/Frameworks/AppKit.framework/Headers/NSDrawer.h:19:8: note: previous definition is here @class NSLock;

ut_unixTimer.h:

#ifndef UT_UNIXTIMER_H
#define UT_UNIXTIMER_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "ut_timer.h"

#ifdef TOOLKIT_COCOA
typedef struct NSMutableDictionary;
typedef struct NSLock;
#endif


class UT_UNIXTimer : public UT_Timer
{
public:
    UT_UNIXTimer(UT_WorkerCallback pCallback, void* pData);
    virtual ~UT_UNIXTimer();

    virtual UT_sint32 set(UT_uint32 iMilliseconds);
    virtual void stop();
    virtual void start();
private:
    typedef UT_sint32 millisec_t;
    millisec_t m_iMilliseconds;
    UT_uint32 m_iGtkTimerId;

#ifdef TOOLKIT_COCOA
    /* these are here for Cocoa timer */
    static NSLock* s_timerMutex;
    static NSMutableDictionary* s_timerIds;
    static int s_lastTimerId;

    friend void _checkLock(void);
    friend void XAP_stopCocoaTimer (UT_uint32 timerId);
    friend UT_uint32 XAP_newCocoaTimer (UT_uint32 time, int (*proc)(void *), void *p);
#endif



};

#endif /* UT_UNIXTIMER_H */
bunbun
  • 2,595
  • 3
  • 34
  • 52
R BENNETT
  • 1
  • 2

1 Answers1

0

This is a pair of meaningless invalid declarations

typedef struct NSMutableDictionary;
typedef struct NSLock;

What were you trying to do here? This looks like an attempt to declare typedef-aliases but the actual aliases are missing. If you wanted to declare aliases for these types, the syntax would be

typedef struct NSMutableDictionary OneAlias;
typedef struct NSLock AnotherAlias;

Fix these declarations or get rid of them entirely and the problem will go away.

AnT stands with Russia
  • 312,472
  • 42
  • 525
  • 765