[Vala] Failed to include the header file



Hi All,
Here's a little example:
 - libtest.vala
        [DBus (name="com.example.LibTest")]
        public class LibTest: Object{
          int i;
          public void method_one()
          {
            stdout.printf("Hello, world\n");
          }
        }
 - test.vala

        public class Test{
          public static void main(){
            LibTest lib = new LibTest();
            lib.method_one();
          }
        }

Compiling with following command.
valac -C -H libtest.h  libtest.vala --library libtest --pkg gio-2.0
valac -C test.vala --vapidir=. --pkg libtest --pkg gio-2.0
gcc test.c libtest.c  `pkg-config --libs --cflags gio-2.0` -I.

The last gcc compiling command output following error message:
  In file included from test.c:7:0:
  ./libtest.h:35:47: error: expected declaration specifiers or ‘...’
  before ‘GDBusConnection’

From the generated ccode, we found that the c code do not include
gio.h. How can I do to fix it?

BTW, I'm using the develement vala - Vala 0.11.7.

Thanks a lot.

Best regards,
Joshua




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