nchudleigh/vimac

get error: "Declaration of 'CGDisplayHideCursor' must be imported from module 'CoreGraphics.CGDirectDisplay' before it is required" when I build

Opened this issue · 0 comments

ENV:

  • Xcode 13.1
  • M1 Apple Silicon
  • Swift 5.5.1
  • OS Big Sur 11.4

get error below when I build:

/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:23:5: error: implicit declaration of function 'CGDisplayHideCursor' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
CGDisplayHideCursor(kCGDirectMainDisplay);
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:23:5: error: declaration of 'CGDisplayHideCursor' must be imported from module 'CoreGraphics.CGDirectDisplay' before it is required
In module 'Foundation' imported from /Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.h:9:
In module 'CoreGraphics' imported from /Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
/Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:398:19: note: declaration here is not visible
CG_EXTERN CGError CGDisplayHideCursor(CGDirectDisplayID display)
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:23:25: error: use of undeclared identifier 'kCGDirectMainDisplay'
CGDisplayHideCursor(kCGDirectMainDisplay);
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:27:5: error: implicit declaration of function 'CGDisplayShowCursor' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
CGDisplayShowCursor(CGMainDisplayID());
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:27:5: error: declaration of 'CGDisplayShowCursor' must be imported from module 'CoreGraphics.CGDirectDisplay' before it is required
In module 'Foundation' imported from /Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.h:9:
In module 'CoreGraphics' imported from /Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
/Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:404:19: note: declaration here is not visible
CG_EXTERN CGError CGDisplayShowCursor(CGDirectDisplayID display)
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:27:25: error: implicit declaration of function 'CGMainDisplayID' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
CGDisplayShowCursor(CGMainDisplayID());
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:27:25: error: declaration of 'CGMainDisplayID' must be imported from module 'CoreGraphics.CGDirectDisplay' before it is required
In module 'Foundation' imported from /Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.h:9:
In module 'CoreGraphics' imported from /Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
/Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:35:29: note: declaration here is not visible
CG_EXTERN CGDirectDisplayID CGMainDisplayID(void)
^
/Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.m:27:25: error: conflicting types for 'CGMainDisplayID'
CGDisplayShowCursor(CGMainDisplayID());
^
In module 'Foundation' imported from /Users/darion/Learning/project/macos/vimac/ViMac-Swift/HideCursorGlobally.h:9:
In module 'CoreGraphics' imported from /Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:9:
/Volumes/Samsung_T5/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:35:29: note: previous declaration is here
CG_EXTERN CGDirectDisplayID CGMainDisplayID(void)
^
8 errors generated.