Repository: opencv
Issue: NSObject error when build source with mac
Labels: category: build/install,category: viz,incomplete

I clone the source code of opencv from git and build using cmake:

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/Cellar -D BUILD_SHARED_LIBS=ON -D WITH_CUDA=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -G "Unix Makefiles" -D BUILD_JAVA_SUPPORT=ON -D WITH_IPP=OFF ..

However, i got NSObject error when compling vtk module:

```
[ 28%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/segmentation.cpp.o
[ 28%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/shapedescr.cpp.o
In file included from /Users/universe/Program/opencv/modules/viz/src/vtk/vtkCocoaInteractorFix.mm:47:
In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:21: error: expected a type
- (id)copyWithZone:(nullable NSZone *)zone;
                    ^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:25:28: error: expected a type
- (id)mutableCopyWithZone:(nullable NSZone *)zone;
                           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:32:4: error: expected a type
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder; // NS_DESIGNATED_INITIALIZER
   ^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:53:4: error: expected a type
- (nullable id)replacementObjectForCoder:(NSCoder *)aCoder;
   ^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:54:4: error: expected a type
- (nullable id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER;
   ^
In file included from /Users/universe/Program/opencv/modules/viz/src/vtk/vtkCocoaInteractorFix.mm:47:
In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:6:
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:15: error: expected ';' after @class
@class NSArray<ObjectType>;
              ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:7:16: error: cannot find protocol declaration for 'ObjectType'
@class NSArray<ObjectType>;
               ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
                        ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:37: error: expected unqualified-id
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
                                    ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:36:4: error: expected a type
- (nullable ObjectType)nextObject;
   ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:25: error: cannot find protocol declaration for 'ObjectType'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                        ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:1: error: duplicate interface definition for class 'NSEnumerator'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:34:12: note: previous definition is here
@interface NSEnumerator<ObjectType> : NSObject <NSFastEnumeration>
           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:37: error: method type specifier must start with '-' or '+'
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                                    ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:40:38: error: expected a type
@interface NSEnumerator<ObjectType> (NSExtendedEnumerator)
                                     ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error: expected selector for Objective-C method
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:28: error: unknown type name 'NSArray'
@property (readonly, copy) NSArray<ObjectType> *allObjects;
                           ^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error: expected member name or ';' after declaration specifiers
@property (readonly, copy) NSArray<ObjectType> *allObjects;
                           ~~~~~~~^
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:1: error: property requires fields to be named
@property (readonly, copy) NSArray<ObjectType> *allObjects;
^                          ~~~~~~~
/System/Library/Frameworks/Foundation.framework/Headers/NSEnumerator.h:42:35: error: expected ';' at end of declaration list
@property (readonly, copy) NSArray<ObjectType> *allObjects;
                                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [modules/viz/CMakeFiles/opencv_viz.dir/src/vtk/vtkCocoaInteractorFix.mm.o] Error 1
make[1]: *** [modules/viz/CMakeFiles/opencv_viz.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
```