c++ - 在 Visual Studio 2010 中使用 LibTiff

标签 c++ visual-studio-2010 libtiff

我正在尝试在 Visual Studio 2010 的 C++ 程序中使用 LibTiff。我从 ftp://ftp.remotesensing.org/pub/libtiff 下载了 tiff-3.9.2.zip。 .要测试 LibTiff,如果有人能一步一步地指导我如何将 libtiff 导入 visual Studio 并构建 Fax2Tiff 工具,那就太好了。

文件太多,弄得我一头雾水。

我已经做了什么:

1) 创建一个名为“TiffTest”的新空 Win32 控制台应用程序项目

2) 将文件夹“libtiff”从 tiff-3.9.2.zip 复制到项目文件夹

3) 将文件“fax2tiff.c”复制到项目文件夹

4) 将这些文件添加到项目中

alt text alt text

5) 将“libtiff”folter 添加到附加包含文件夹

6) 将文件“tif_config.vc.h”和“tiffconf.vc.h”重命名为“tif_config.h”和“tiffconf.h”

7) 试图编译它。

这实际上行不通。我为摆脱错误消息所做的一切都会导致新的错误消息。谁能告诉我如何让 libtiff 工作?

我真的需要帮助...

非常感谢!

最佳答案

我觉得会更好

  • 将 libtiff 构建为静态库。
  • 将 fax2tiff 构建为与图书馆链接的控制台应用程序

此外,您应该决定要在您的库版本中使用哪个版本的文件和内存相关文件。与文件和内存相关的文件有 Unix、DOS 和 Windows 风格的版本。

对于 fax2tiff,您可能需要 Windows 版本的 getopt.cgetopt.h 文件。您可以使用 wingetopt.hwingetopt.c found on koders.com

我成功地使用了使用这种方法构建的 libtiff-3.9.4 和 tiff2pdf。

顺便说一句,libtiff 版本 3.9.4 是 3.x 分支中的最新版本。

下面是我的LibTiff.vcxproj 的一部分。它显示了使用 Visual Studio 2010 在 Windows 上构建 libtiff 需要哪些文件。

<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" />

关于c++ - 在 Visual Studio 2010 中使用 LibTiff,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4647791/

相关文章:

.net - 使用 Windows Azure 工具,为什么我会收到对内存位置的无效访问?

c# - 如何在 ASP MVC 中使用 JavaScript 禁用 EditorFor

c++ - 构建独立的 Libtiff (Linux)

c++ - 我如何使用 Qt 查看大图像?

c++ - 在 Visual C++ 2008/2010 Express 中编写 Linux 控制台应用程序

C++11 预定义宏

c++ - 视频中的Opencv马赛克

C++从十六进制字符串转换为int时出错

c++ - 在 Visual Studio Express 2010 上设置根库

linux - TIFF 打开 : Too many open files