I have just built and installed tiff-4.0.0beta6 on my Mac computer running Snow Leo开发者_如何转开发pard. I followed the tutorial at http://www.kyngchaos.com/macosx/build/libtiff. The install went fine but there are issues with the TIFF data type.
For exmaple, when I compile the following simple code:
#include "tiffio.h"
main()
{
TIFF* tif = TIFFOpen("foo.tif", "r");
TIFFClose(tif);
}
I get the error message:
hlrg-labs-imac:metrics Ben$ gcc main.c
Undefined symbols:
"_TIFFOpen", referenced from:
_main in cciewEwr.o
"_TIFFClose", referenced from:
_main in cciewEwr.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
When I compile the code:
#include "tiffio.h"
main()
{
TIFF tif;
}
I get the compilation error:
hlrg-labs-imac:metrics Ben$ gcc main.c
main.c: In function ‘main’:
main.c:5: error: storage size of ‘tif’ isn’t known
Any suggestions on this would be greatly appreciated.
Thanks.
When you compile you need to include the -ltiff switch. For example:
gcc main.c -ltiff -o main
Also, in your second example it should be
main(){ TIFF* tif; }
精彩评论