如何在VS2010中链接pngLib [英] How do I link a pngLib in VS2010

查看:160
本文介绍了如何在VS2010中链接pngLib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将png图像加载到数组中.我被告知要下载CImg库.
问题是它使用了我不知道如何链接的pngLib.
我从libpng主页下载了一些文件,但是将目录添加到其他包含目录,将h文件添加到项目并将zlib1.dll复制到exe目录是不够的.

尝试使用该类时出现错误:

myFloatImg(300,200);
字符串testFilename ="testImage.png";
myFloatImg.load(filename.c_str());


错误:
c:\ ... \ cimg.h(34670):错误C3861:``png_set_expand_gray_1_2_4_to_8'':找不到标识符

我想这是对pngLib函数的调用
我应该怎么办?
* openCV不是一个选择

I want to load a png image into an array. I was told to download the CImg library.
The problem is that it uses the pngLib which I don''t know how to link.
I downloaded some files from the libpng homepage, but adding the directory to additional include directories, the h files to the project and copying the zlib1.dll to the exe directory is not enough.

I get an error when I try to use the class:

myFloatImg (300,200);
string testFilename="testImage.png";
myFloatImg.load (filename.c_str());


the error:
c:\...\cimg.h(34670): error C3861: ''png_set_expand_gray_1_2_4_to_8'': identifier not found

I guess it''s a call to a function from pngLib
What should I do?
*openCV is not an option

Thanks!

推荐答案

问题不是库链接问题.
您可能缺少某些头文件(#include)或未使用名称空间名称(使用名称空间).

您要如何处理图片?
您可以尝试使用GDI +.
GDI +有几个类,例如Image,Graphics等,它们可以执行很多图像操作,并且也支持PNG.
The issue is not a library linking issue.
You''re probably missing some header file (#include) or are not using a namespace name (using namespace).

What are you trying to do with the image?
You could try to use GDI+.
GDI+ has several classes like Image, Graphics etc. that can do a lot of image manipulation and it supports PNG too.


我应该以其他依赖方式链接pngLib和zlib的objs. br/> 应该将它们添加为"pnglib.lib,zlib.lib"
I should have link the objs of pngLib and zlib in additional dependences.
They should be added there as "pnglib.lib, zlib.lib"


这篇关于如何在VS2010中链接pngLib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆