2017-08-10 77 views
1
package main 

//#cgo CFLAGS: -I/home/me/geany/scintilla/include 
//#include <ScintillaWidget.h> 
import "C" 

import (
    "github.com/mattn/go-gtk/gtk" 
) 

func main() { 
    gtk.Init(nil) 
    window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL) 
    window.SetPosition(gtk.WIN_POS_CENTER) 
    window.SetTitle("GTK Go!") 
    window.SetIconName("textview") 
    window.Connect("destroy", gtk.MainQuit) 
    window.SetSizeRequest(600, 600) 
    C.scintilla_new(); 
    window.ShowAll() 
    gtk.Main() 
} 

這是錯誤我得到:在CGO包導入C.scintilla_new()

# _/home/me/gosci/gosci 
could not determine kind of name for C.scintilla_new 

的定義顯然是在頭在第58行:

GtkWidget* scintilla_new  (void); 

如何編譯這個?

回答

1

可能GtkWidget未在ScintillaWidget.h中聲明,您首先需要#include <gtk/gtk.h>