Greetings,
I am unable to find a good windows/vala/genie
Forum. So, thought i'd try here:
I am getting two errors, apparently from the #include.
The gtk.h is here:
C:\vala-0.12\Vala\vala-win32\vala-win32\gtk-bin\include\gtk-2.0\gtk
How do i tell valac where gtk.h is?
Pls, where does the #include belong.(see source below)
Thanks...Vernon
C:\vala-0.12\vmVala>valac -o Button Button.vala
Button.vala:2.2-2.9: error: syntax error, invalid preprocessing directive
#include <gtk/gtk.h>
^^^^^^^^
Button.vala:2.10-2.10: error: syntax error, expected identifier
#include <gtk/gtk.h>
^
Compilation failed: 2 error(s), 0 warning(s)
=======================
// C:\vala-0.12\Vala\vala-win32\vala-win32\gtk-bin\include\gtk-2.0\gtk
#include <gtk/gtk.h>
using Gtk;
public void on_button_clicked(Button source)
{
stdout.printf("Button clicked\n");
}
int main(string[] args)
{
Gtk.init(ref args);
var window = new Window();
window.destroy.connect(Gtk.main_quit);
var button = new Button.with_label("Button");
button.clicked.connect(on_button_clicked);
window.add(button);
window.show_all();
Gtk.main();
return 0;
}
Button.vala #include <gtk/gtk.h> errors:
Welcome,
are you compiling on Windows or Linux under WINE?
It may be worth asking specific questions on the programming sub forum
http://www.murga-linux.com/puppy/index.php?f=46
are you compiling on Windows or Linux under WINE?
It may be worth asking specific questions on the programming sub forum
http://www.murga-linux.com/puppy/index.php?f=46
Vala is not the same as C, the GTK headers are included with the statement ‘using GTK;’ and then compiling with ‘valac --pkg gtk+-2.0 yourfile.vala’ so you do not #include <gtk/gtk.h>
Look at the examples here https://live.gnome.org/Vala/GTKSample
save as test.vala and compile with valac --pkg gtk+-2.0 test.vala
Look at the examples here https://live.gnome.org/Vala/GTKSample
Code: Select all
using Gtk;
public void on_button_clicked(Button source){
stdout.printf("Button clicked\n");
}
int main(string[] args){
Gtk.init(ref args);
var window = new Window();
window.destroy.connect(Gtk.main_quit);
var button = new Button.with_label("Button");
button.clicked.connect(on_button_clicked);
window.add(button);
window.show_all();
Gtk.main();
return 0;
}
/root for the home team
I am compiling under Windows7.darkcity wrote:Welcome,
are you compiling on Windows or Linux under WINE?
Yes, will do:
http://www.murga-linux.com/puppy/index.php?f=46
...vm