robotgo icon indicating copy to clipboard operation
robotgo copied to clipboard

error: use of undeclared identifier 'kVK_RightCommand'

Open krostar opened this issue 4 years ago • 1 comments

  • Robotgo version (or commit ref): v0.92.1
  • Go version: go1.15.4 darwin/amd64
  • Gcc version: Apple clang version 12.0.0 (clang-1200.0.32.21)
  • Operating system and bit: macOS Catalina 10.15.7
  • Resolution: 1440*900
  • Can you reproduce the bug at :
    • [x] Yes (provide example code)
    • [ ] No
    • [ ] Not relevant
  • Provide example code:
package main

import (
	"fmt"

	"github.com/go-vgo/robotgo"
)

func main() {
	fmt.Println(robotgo.GetPixelColor(100, 100))
}
module foo

go 1.15

require github.com/go-vgo/robotgo v0.92.1

Description

Hi, when I try to compile the program above I get the following error

Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling ....
Enabled Go module support
Building /source/go.mod...
Compiling for darwin-10.6/amd64...
# github.com/go-vgo/robotgo
In file included from /go/pkg/mod/github.com/go-vgo/[email protected]/robotgo.go:44:
In file included from ./key/goKey.h:14:
In file included from ./key/keypress_c.h:1:
In file included from ./key/keypress.h:6:
./key/keycode.h:62:12: error: use of undeclared identifier 'kVK_RightCommand'
        K_RMETA = kVK_RightCommand,

It looks like the key kVK_RightCommand does not exists. After a quick search I found this issue which suggests the following change.

I tried the suggested change in a fork, and I successfully compile the same go code above using the following go.mod

module foo

go 1.15

require github.com/go-vgo/robotgo v0.92.1

replace github.com/go-vgo/robotgo v0.92.1 => github.com/krostar/robotgo v0.92.2-0.20201112181729-dde19e3430d6
Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling ....
Enabled Go module support
Building /source/go.mod...
Compiling for darwin-10.6/amd64...
# github.com/go-vgo/robotgo
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(png.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngread.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngwrite.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngmem.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngget.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngset.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngtrans.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngrtran.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngerror.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngwio.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngrutil.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngwutil.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngwtran.o)) was built for newer OSX version (10.10) than being linked (10.6)
ld: warning: object file (/go/pkg/mod/github.com/krostar/[email protected]/cdeps/mac/libpng.a(pngrio.o)) was built for newer OSX version (10.10) than being linked (10.6)
Cleaning up build environment...
./foo-darwin-10.6-amd64
16191f

Do you want to suggest the change I made in my fork in a pull request ?

I hope this issue help krostar

krostar avatar Nov 12 '20 18:11 krostar

But I can't reproduce it on my Macos.

vcaesar avatar Nov 26 '20 16:11 vcaesar