go-gtk icon indicating copy to clipboard operation
go-gtk copied to clipboard

4025: cannot use value (type unsafe.Pointer) as type C.gpointer

Open Petricevic opened this issue 8 years ago • 9 comments

Debian 64 with Mate gtk installed I this message and I can not go on: go/src/github.com/mattn/go-gtk/gtk/gtk.go:4025: cannot use value (type unsafe.Pointer) as type C.gpointer in argument to _Cfunc_to_GTreePath thank you

Petricevic avatar Oct 14 '16 14:10 Petricevic

what version of go do you use? gccgo?

mattn avatar Oct 14 '16 15:10 mattn

paolo@paolo:~$ go version go version go1.3.3 linux/amd64

paolo@paolo:~$ gccgo version bash: gccgo: command not found

Petricevic avatar Oct 15 '16 03:10 Petricevic

bits older. But if this fixes your problem, I'll merge this.

diff --git a/gtk/gtk.go b/gtk/gtk.go
index 8b2a3fb..b6fd827 100644
--- a/gtk/gtk.go
+++ b/gtk/gtk.go
@@ -4022,7 +4022,7 @@ func NewTreePathFromString(path string) *TreePath {
    return &TreePath{C.gtk_tree_path_new_from_string(gstring(ptr))}
 }
 func TreePathFromNative(value unsafe.Pointer) *TreePath {
-   return &TreePath{C.to_GTreePath(value)}
+   return &TreePath{C.to_GTreePath(C.gpointer(value))}
 }
 func NewTreePathNewFirst() *TreePath {
    return &TreePath{C.gtk_tree_path_new_first()}

mattn avatar Oct 15 '16 05:10 mattn

I put the local changes and filling I: ../github.com/mattn/go-gtk/gtk/gtk.go:4033:29: expected ';', found 'IDENT' string

4020 func NewTreePathFromString(path string) *TreePath { 4021 return &TreePath{C.gtk_tree_path_new_from_string(gstring(ptr))} 4022 } 4023 4024 func TreePathFromNative(value unsafe.Pointer) *TreePath { 4025 return &TreePath{C.to_GTreePath(C.gpointer(value))} 4026 } 4027 4028 func NewTreePathNewFirst() *TreePath { 4029 return &TreePath{C.gtk_tree_path_new_first()} 4030 4031 // gtk_tree_path_new_from_indices 4032 4033 func (v *TreePath) String() string { 4034 return gostring(C.gtk_tree_path_to_string(v.GTreePath)) 4035 }

Petricevic avatar Oct 15 '16 06:10 Petricevic

Could you please send me pull-request?

mattn avatar Oct 15 '16 07:10 mattn

I tried to compile the example: go-gtk/example/action/

Petricevic avatar Oct 15 '16 07:10 Petricevic

go 1.3 is too old.

mattn avatar Oct 15 '16 07:10 mattn

as an example I can try?

Petricevic avatar Oct 15 '16 07:10 Petricevic

Sorry, I don't use go1.3, so I don't know which you can try.

mattn avatar Oct 15 '16 07:10 mattn