[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Vala] structs and lists



Hi people :

Anybody can help me with this code ? I want to add a struct to a GList.
But....

valac --pkg glib-2.0 --pkg gtk+-2.0 -o struct struct.vala

struct.c: In function 'xclass_run':
struct.c:37: error: incompatible type for argument 2 of 'g_list_append'
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

telemaco
/* -*- Mode: Vala; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */

using GLib;


struct XStruct
{	
		public int integer;
		public SList items;
}

public class XClass {
		private List<XStruct> x_list;

		construct{
				this.x_list = null;
		}

		public void run (){
				var x = XStruct();
				x.integer = 1;
				this.x_list.append(x);
		}

		static int main (string[] args) {
				XClass obj = new XClass();
				obj.run();
				return 0;
		}

}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]