Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 19 Jun 2013, 21:25
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Button.vala #include <gtk/gtk.h> errors:
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
vmars316


Joined: 26 Apr 2012
Posts: 62
Location: Brownsville, Texas, USA

PostPosted: 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
View user's profile Send private message 
darkcity


Joined: 23 May 2010
Posts: 2218
Location: near here

PostPosted: 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

Twisted Evil

_________________
Wiki Audacity 2.0.1
Back to top
View user's profile Send private message Visit poster's website 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: 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
View user's profile Send private message 
vmars316


Joined: 26 Apr 2012
Posts: 62
Location: Brownsville, Texas, USA

PostPosted: Sun 29 Apr 2012, 15:35    Post subject:  

darkcity wrote:
Welcome,
are you compiling on Windows or Linux under WINE?
Twisted Evil


I am compiling under Windows7.

Yes, will do:
http://www.murga-linux.com/puppy/index.php?f=46

...vm
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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.0427s ][ Queries: 12 (0.0054s) ][ GZIP on ]