nchudleigh / vimac

Productive macOS keyboard-driven navigation
https://vimacapp.com
GNU General Public License v3.0
3.38k stars 124 forks source link

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

Open brother-darion opened 2 years ago

brother-darion commented 2 years ago

ENV:

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.