You are here

Add new comment

Tutorial : Using Go with GTK+3 on Windows

Objectives : compile a Go sample using GTK+3 on Windows.

Many thanks to Vasileios Anagnostopoulos for the information needed to write this article.

Go is a relatively new object-oriented language from Google, aiming at both simplicity and performance.

We will see how to setup Go, GCC and GTK+3 under Windows, and compile a simple example.

1) Install the Vala bundle for Windows

We are not installing the bundle for Vala itself, but rather for the GCC compiler and GTK+3 binaries found therein.

vala-0.20.1_(GTK+-3.6.4)(TARNYKO).exe (74.4 Mb)

Install it to "c:\langs\vala" :



2) Install Go for Windows

Download the latest ZIP file from the Go Windows archive ("go1.1.1.windows-386.zip" at the time of writing).

Extract it to "c:\langs", so it creates a new "c:\langs\go" folder :



3) Install Git for Windows

Git is a well-known version control system, and the preferred way to download GoGTK3 bindings.

Download the latest Git (not msysgit, though it could work) installer from the Git Windows archive ("Git-1.8.1.2-preview20130201.exe" at the time of writing).

Install it to "c:\git", letting other options untouched :



4) Define environment variables

Open a console (Start -> Run -> "cmd") and type the following commands :

set PATH=%PATH%;c:\langs\go\bin;c:\git\bin
set GOROOT=c:\langs\go

Try to run "gcc", "gtk3-demo", "go" and "git" from this console. They should all work.
Don't close the console for now.

4) Download the GoGTK3 bindings

Create a new "c:\langs\gopath" folder.

In the console, type :
set GOPATH=c:\langs\gopath

And now download the bindings using Git :
go get github.com/conformal/gotk3/gtk

5) Compile the sample code

We go the the new folder containing the sample :
cd c:\langs\gopath\src\github.com\conformal\gotk3\gtk\examples\grid
and compile it :
go build grid.go

The new "grid.exe" executable should run flawlessly :

Here we go !

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.