Re: [Vala] Using LibTIFF (Undefined Reference TIFFOpen and TIFFClose)



On Wed, 2012-03-28 at 09:52 -0500, Tim Way wrote:
Hi,

I am trying to use LibTIFF to work with mulit-page TIFF files. I cannot
seem to get off the starting blocks. I found that libtiff has a .vapi file
built into vala but when I try to use it with this tidbit of code

using Tiff;

...

TIFF testobj = new TIFF("/home/xuser/Pictures/Test.tif", "r");

...

I get the following errors running my valac command:

me host$ valac --pkg gtk+-3.0 --pkg tiff test.vala

test.vala:18.12-18.75: warning: local variable `testobj' declared but never
used
      TIFF testobj = new TIFF("/home/xuser/Pictures/Test.tif", "r");
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/tmp/cceW1BJ0.o: In function `_vala_main':
test.vala.c:(.text+0x207): undefined reference to `TIFFOpen'
test.vala.c:(.text+0x252): undefined reference to `TIFFClose'
test.vala.c:(.text+0x4af): undefined reference to `TIFFClose'
collect2: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)

Is this a problem with the bindings or am I just using this incorrectly?

Vala can only automatically link libraries which provide a pkg-config
file, which (AFAIK) libtiff does not.  You'll need to manually make sure
libtiff gets linked... something like this should do the trick:

valac --pkg gtk+-3.0 --pkg tiff -X -ltiff test.vala


-Evan




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