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

Strange error im getting. #41

Open
zLeki opened this issue Apr 6, 2022 · 3 comments
Open

Strange error im getting. #41

zLeki opened this issue Apr 6, 2022 · 3 comments

Comments

@zLeki
Copy link

zLeki commented Apr 6, 2022

Screen Shot 2022-04-06 at 7 19 23 PM
Not really sure what's happening here. Looks like it can't a reference for that var.

Large error below

GOROOT=/usr/local/go #gosetup
GOPATH=/Users/leki/go #gosetup
/usr/local/go/bin/go build -o /private/var/folders/1h/j6ckgx_n6td25545c0w84kn00000gn/T/GoLand/___go_build_github_com_zLeki_JJBot github.com/zLeki/JJBot #gosetup
github.com/micmonay/keybd_event
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:73:2: could not determine kind of name for C.AddActionKey
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:69:18: could not determine kind of name for C.CGEventRef
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:85:15: could not determine kind of name for C.CreateDown
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:110:13: could not determine kind of name for C.CreateUp
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:107:2: could not determine kind of name for C.KeyTap
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:27:21: could not determine kind of name for C.kCGEventFlagMaskAlphaShift
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:30:21: could not determine kind of name for C.kCGEventFlagMaskAlternate
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:31:21: could not determine kind of name for C.kCGEventFlagMaskCommand
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:29:21: could not determine kind of name for C.kCGEventFlagMaskControl
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:32:21: could not determine kind of name for C.kCGEventFlagMaskHelp
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:35:21: could not determine kind of name for C.kCGEventFlagMaskNonCoalesced
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:34:21: could not determine kind of name for C.kCGEventFlagMaskNumericPad
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:33:21: could not determine kind of name for C.kCGEventFlagMaskSecondaryFn
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:28:21: could not determine kind of name for C.kCGEventFlagMaskShift
cgo:
clang errors for preamble:
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:7:2: error: unknown type name 'CGEventRef'
CGEventRef CreateDown(int k){
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:8:2: error: use of undeclared identifier 'CGEventRef'
CGEventRef event = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)k, true);
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:9:9: error: use of undeclared identifier 'event'
return event;
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:11:2: error: unknown type name 'CGEventRef'
CGEventRef CreateUp(int k){
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:12:2: error: use of undeclared identifier 'CGEventRef'
CGEventRef event = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)k, false);
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:13:9: error: use of undeclared identifier 'event'
return event;
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:15:14: error: unknown type name 'CGEventRef'
void KeyTap(CGEventRef event){
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:16:14: error: use of undeclared identifier 'kCGAnnotatedSessionEventTap'
CGEventPost(kCGAnnotatedSessionEventTap, event);
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:19:20: error: unknown type name 'CGEventFlags'; did you mean 'MPEventFlags'?
void AddActionKey(CGEventFlags type,CGEventRef event){
^~~~~~~~~~~~
MPEventFlags
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Multiprocessing.h:119:41: note: 'MPEventFlags' declared here
typedef UInt32 MPEventFlags;
^
../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:19:38: error: unknown type name 'CGEventRef'
void AddActionKey(CGEventFlags type,CGEventRef event){
^
10 errors generated.

Compilation finished with exit code 2

@daibertdiego
Copy link

Same error here trying to rum the example on my MacOS and golang go1.18 darwin/amd64

# github.com/micmonay/keybd_event ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:73:2: could not determine kind of name for C.AddActionKey ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:69:18: could not determine kind of name for C.CGEventRef ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:85:15: could not determine kind of name for C.CreateDown ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:110:13: could not determine kind of name for C.CreateUp ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:107:2: could not determine kind of name for C.KeyTap ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:27:21: could not determine kind of name for C.kCGEventFlagMaskAlphaShift ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:30:21: could not determine kind of name for C.kCGEventFlagMaskAlternate ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:31:21: could not determine kind of name for C.kCGEventFlagMaskCommand ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:29:21: could not determine kind of name for C.kCGEventFlagMaskControl ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:32:21: could not determine kind of name for C.kCGEventFlagMaskHelp ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:35:21: could not determine kind of name for C.kCGEventFlagMaskNonCoalesced ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:34:21: could not determine kind of name for C.kCGEventFlagMaskNumericPad ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:33:21: could not determine kind of name for C.kCGEventFlagMaskSecondaryFn ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:28:21: could not determine kind of name for C.kCGEventFlagMaskShift cgo: clang errors for preamble: ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:7:2: error: unknown type name 'CGEventRef' CGEventRef CreateDown(int k){ ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:8:2: error: use of undeclared identifier 'CGEventRef' CGEventRef event = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)k, true); ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:9:9: error: use of undeclared identifier 'event' return event; ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:11:2: error: unknown type name 'CGEventRef' CGEventRef CreateUp(int k){ ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:12:2: error: use of undeclared identifier 'CGEventRef' CGEventRef event = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)k, false); ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:13:9: error: use of undeclared identifier 'event' return event; ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:15:14: error: unknown type name 'CGEventRef' void KeyTap(CGEventRef event){ ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:16:14: error: use of undeclared identifier 'kCGAnnotatedSessionEventTap' CGEventPost(kCGAnnotatedSessionEventTap, event); ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:19:20: error: unknown type name 'CGEventFlags'; did you mean 'MPEventFlags'? void AddActionKey(CGEventFlags type,CGEventRef event){ ^~~~~~~~~~~~ MPEventFlags /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Multiprocessing.h:119:41: note: 'MPEventFlags' declared here typedef UInt32 MPEventFlags; ^ ../../../../../../go/pkg/mod/github.com/micmonay/[email protected]/keybd_darwin.go:19:38: error: unknown type name 'CGEventRef' void AddActionKey(CGEventFlags type,CGEventRef event){ ^ 10 errors generated.

@thalesog
Copy link
Contributor

thalesog commented Jun 5, 2022

I was getting the same error, after add a missing import on C++ code, everything worked.

The fix is in PR #42

@PrabhakarRai
Copy link

PR #42 has still not resolved the name and type errors. It seems that problem lies in path resolution of headers.

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

4 participants