首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CImg加载PNG

使用CImg加载PNG
EN

Stack Overflow用户
提问于 2010-10-23 08:19:45
回答 1查看 4.3K关注 0票数 5

我无法使用CImg加载PNG。我听说你需要先获取libpng / zlib才能开始工作,但我不确定如何设置。我在Ubuntu上。我的消息来源:

代码语言:javascript
复制
#include <cmath>
#include <cstdio>
#include <string>
#include <assert.h>
#include <stdarg.h>

#define cimg_using_png
#include "CImg.h"
using namespace cimg_library;
#include "png.h"

int main(int argc, char** argv)
{
    CImg<unsigned char> img2("test.png");
    img2.display();
    return 0;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-01-16 23:42:22

很接近,但您需要#define cimg_use_png

并将-lpng添加到链接器标志。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4001816

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档