[Vala] warning calling extern function



I'm trying to write a trivial program that calls an extern program. I have the following:

== foo.vala ==

extern int add(int a, int b);

void main() {
stdout.printf("%d\n", add(3, 4));
}

== lib.c ==

int add(int a, int b) {
return a + b;
}

=======

When I build, I get a warning:

$ valac foo.vala lib.c
foo.c:10: warning: ‘add’ used but never defined
$

The program runs fine. Am I doing something wrong? Or is the warning a Vala bug?

adam




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