Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brother-darion opened this issue Nov 28, 2021 · 0 comments

Comments

@brother-darion
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant