Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

c++ - Using LibTiff in Visual Studio 2010

I'm trying to use LibTiff in a C++ Program in Visual Studio 2010. I downloaded tiff-3.9.2.zip from ftp://ftp.remotesensing.org/pub/libtiff. To test LibTiff it would be nice if someone could give me a step by step instruction how to import libtiff to visual Studio and build the Fax2Tiff tool.

There are so many files so that I am totally confused.

What I already have done:

1) Created a new Empty Win32 Console Application Project named "TiffTest"

2) Copied the folder "libtiff" from the tiff-3.9.2.zip to the Project Folder

3) Copied the file "fax2tiff.c" to the Project Folder

4) Added those files to the Project

alt textalt text

5) Added the "libtiff" folter to the additional include folders

6) Renamed the files "tif_config.vc.h" and "tiffconf.vc.h" to "tif_config.h" and "tiffconf.h"

7) Tried to compile it.

This does not really work. All I do to get rid of the error messages causes new error messages. Can anyone tell me how I can get libtiff to work?

I really need help...

Thank you so much!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think it would be better

  • to build libtiff as a static library.
  • to build fax2tiff as a console application that links with the library

In addition, you should decide which version of the file- and memory-related files you want to use in your version of the library. There are Unix, DOS and Windows-style versions for file- and memory related files.

And for fax2tiff you will probably need Windows version of the getopt.c and getopt.h files. You may use wingetopt.h and wingetopt.c found on koders.com

I successfully use libtiff-3.9.4 and tiff2pdf built using this approach.

Btw, libtiff version 3.9.4 is most recent one in 3.x branch.

Below is the part of my LibTiff.vcxproj. It shows which files are needed to build libtiff on Windows using Visual Studio 2010.

<ItemGroup>
    <ClInclude Include="t4.h" />
    <ClInclude Include="tiff.h" />
    <ClInclude Include="tiffconf.h" />
    <ClInclude Include="tiffio.h" />
    <ClInclude Include="tiffiop.h" />
    <ClInclude Include="tiffvers.h" />
    <ClInclude Include="tif_config.h" />
    <ClInclude Include="tif_dir.h" />
    <ClInclude Include="tif_fax3.h" />
    <ClInclude Include="tif_predict.h" />
    <ClInclude Include="uvcode.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="tif_aux.c" />
    <ClCompile Include="tif_close.c" />
    <ClCompile Include="tif_codec.c" />
    <ClCompile Include="tif_color.c" />
    <ClCompile Include="tif_compress.c" />
    <ClCompile Include="tif_dir.c" />
    <ClCompile Include="tif_dirinfo.c" />
    <ClCompile Include="tif_dirread.c" />
    <ClCompile Include="tif_dirwrite.c" />
    <ClCompile Include="tif_dumpmode.c" />
    <ClCompile Include="tif_error.c" />
    <ClCompile Include="tif_extension.c" />
    <ClCompile Include="tif_fax3.c" />
    <ClCompile Include="tif_fax3sm.c" />
    <ClCompile Include="tif_flush.c" />
    <ClCompile Include="tif_getimage.c" />
    <ClCompile Include="tif_jbig.c" />
    <ClCompile Include="tif_jpeg.c" />
    <ClCompile Include="tif_luv.c" />
    <ClCompile Include="tif_lzw.c" />
    <ClCompile Include="tif_next.c" />
    <ClCompile Include="tif_ojpeg.c" />
    <ClCompile Include="tif_open.c" />
    <ClCompile Include="tif_packbits.c" />
    <ClCompile Include="tif_pixarlog.c" />
    <ClCompile Include="tif_predict.c" />
    <ClCompile Include="tif_print.c" />
    <ClCompile Include="tif_read.c" />
    <ClCompile Include="tif_strip.c" />
    <ClCompile Include="tif_swab.c" />
    <ClCompile Include="tif_thunder.c" />
    <ClCompile Include="tif_tile.c" />
    <ClCompile Include="tif_unix.c" />
    <ClCompile Include="tif_version.c" />
    <ClCompile Include="tif_warning.c" />
    <ClCompile Include="tif_write.c" />
    <ClCompile Include="tif_zip.c" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...