The time now is Wed 19 Jun 2013, 09:47
All times are UTC - 4 |
| Author |
Message |
vmars316

Joined: 26 Apr 2012 Posts: 62 Location: Brownsville, Texas, USA
|
Posted: Thu 26 Apr 2012, 15:01 Post subject:
Button.vala #include <gtk/gtk.h> errors: Subject description: error: syntax error, invalid preprocessing directive #include <gtk/gtk.h> |
|
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;
}
|
|
Back to top
|
|
 |
darkcity

Joined: 23 May 2010 Posts: 2218 Location: near here
|
Posted: Sat 28 Apr 2012, 06:31 Post subject:
|
|
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
_________________ Wiki Audacity 2.0.1
|
|
Back to top
|
|
 |
Mobeus

Joined: 26 Aug 2010 Posts: 94
|
Posted: Sat 28 Apr 2012, 12:21 Post subject:
|
|
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
| Code: | 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;
}
|
save as test.vala and compile with valac --pkg gtk+-2.0 test.vala
_________________ /root for the home team
|
|
Back to top
|
|
 |
vmars316

Joined: 26 Apr 2012 Posts: 62 Location: Brownsville, Texas, USA
|
Posted: Sun 29 Apr 2012, 15:35 Post subject:
|
|
| darkcity wrote: | Welcome,
are you compiling on Windows or Linux under WINE?
 |
I am compiling under Windows7.
Yes, will do:
http://www.murga-linux.com/puppy/index.php?f=46
...vm
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|
[ Time: 0.0516s ][ Queries: 12 (0.0129s) ][ GZIP on ] |