在 VisualStudio2008 中获取 libpng 用于开发的最快、最简单的方法是什么?
我有一些使用 boost 的 GIL 图像库的 C++ 代码,并且想要使用 boost/gil/extension/io/png_io.hpp
中的 boost::gil::png_write_view
写入文件>。该标头本身包含 png.h
,当然会导致链接依赖性。
在 Debian 上它可以正常编译和链接。如果它确实抱怨缺少任何内容,则通过 aptitude install libpng-dev 只需几秒钟即可获得必要的标头和库。
在 Windows(XP64 上的 VisualStudio 2008)上,我不得不面对这样的想法:看起来我必须自己从源代码(以及它的 zlib 依赖项)构建 libpng。如果已经有明显的包装,我就看不到它。谁能告诉我是否有这样有用的资源?
I have some C++ code which uses boost's GIL image library, and wants to write files using boost::gil::png_write_view
from boost/gil/extension/io/png_io.hpp
. That header itself includes png.h
, and of course results on a link dependency.
On Debian it compiles and links fine. If it did complain about anything missing, the necessary headers and libs would be a few seconds away via an aptitude install libpng-dev
.
On Windows (VisualStudio 2008 on XP64), I'm having to face the idea that it looks like I'll have to build libpng from source (and so also its zlib dependency) myself. If there's an obvious packaging already out there, I'm not seeing it. Can anyone enlighten me if there is such a useful resource anywhere ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Libpng自己的包装本身似乎提供了vc6和VC7.1(VS2003)的项目文件。最新版本还附带 VC10 项目文件。但对于 VC8(VS2005) 或 VC9(VS2008) 没有任何影响。但是,这里有说明(我还没有尝试)其中描述了通过转换向导运行 7.1 项目文件后 2008 年的构建。
我最初确实尝试过 GnuWin32 版本的 libpng,但是(除了仅限 32 位之外)当从 VS2008 的 CRT 传递 FILE* 时,它在 libpng 调用 fwrite 时崩溃。 libpng 自己的文档对此以及混合不同版本的 MSVC 的危险有一些说明,但他们建议的解决方法仅与直接 libpng 用户相关(我通过 boost GIL 使用它)。
更新:转换后的项目文件确实工作得很好(也许有一些小的明显的修复)。到目前为止,工作的最大部分是创建 64 位版本;原始和转换后的项目文件不包含任何此类配置,虽然 Visual Studio 将尝试创建它们,但需要进行大量配置对话框编辑才能获得一致的文件夹/文件名等。
Libpng's own packaging itself seems to supply project files for vc6 and VC7.1 (VS2003). And more recent releases also come with VC10 project files. But nothing for VC8(VS2005) or VC9(VS2008). However there are instructions here (which I've yet to try) which describe building for 2008 after running the 7.1 project files through the conversion wizard.
I did initally try the GnuWin32 build of libpng, but (apart from being 32 bit only) it crashed in a libpng call to fwrite when passed a FILE* from VS2008's CRT. libpng's own documentation has something to say about this and the perils of mixing different versions of MSVC but their suggested workround is only relevant to direct libpng users (and I'm using it via boost GIL).
Update: the converted project files do work pretty well (maybe some minor obvious fixups). By far the biggest part of the job was creating the 64bit builds; the original and converted project files don't include any such configuration and while visual studio will have a go at creating them, there was a fair amount of config dialog editing to get consistent folder/file names etc.