初学写png图像文件,编译例子程序出问题了?

重复贴和参考价值不大的帖子,版主维护
回复
snail.chenhuabin
帖子: 22
注册时间: 2008-03-17 17:07
来自: 江苏苏州
送出感谢: 0
接收感谢: 0
联系:

初学写png图像文件,编译例子程序出问题了?

#1

帖子 snail.chenhuabin » 2008-03-21 17:03

http://www.libpng.org/pub/png/book/sour ... l在这里下载的源代码
我编译的是wpng.c,writepng.c,writepng.h这三个文件,出错内容如下
writepng.o: In function `writepng_version_info':
writepng.c:(.text+0xf): undefined reference to `png_libpng_ver'
writepng.c:(.text+0x2c): undefined reference to `zlibVersion'
writepng.o: In function `writepng_init':
writepng.c:(.text+0x7f): undefined reference to `png_create_write_struct'
writepng.c:(.text+0xa3): undefined reference to `png_create_info_struct'
writepng.c:(.text+0xc0): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0xf3): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0x117): undefined reference to `png_init_io'
writepng.c:(.text+0x12a): undefined reference to `png_set_compression_level'
writepng.c:(.text+0x178): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0x1ea): undefined reference to `png_set_IHDR'
writepng.c:(.text+0x217): undefined reference to `png_set_gAMA'
writepng.c:(.text+0x270): undefined reference to `png_set_bKGD'
writepng.c:(.text+0x28f): undefined reference to `png_convert_from_time_t'
writepng.c:(.text+0x2a8): undefined reference to `png_set_tIME'
writepng.c:(.text+0x4c3): undefined reference to `png_set_text'
writepng.c:(.text+0x4d5): undefined reference to `png_write_info'
writepng.c:(.text+0x4e0): undefined reference to `png_set_packing'
writepng.o: In function `writepng_encode_image':
writepng.c:(.text+0x549): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0x57b): undefined reference to `png_write_image'
writepng.c:(.text+0x58e): undefined reference to `png_write_end'
writepng.o: In function `writepng_encode_row':
writepng.c:(.text+0x5d6): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0x608): undefined reference to `png_write_row'
writepng.o: In function `writepng_encode_finish':
writepng.c:(.text+0x650): undefined reference to `png_destroy_write_struct'
writepng.c:(.text+0x680): undefined reference to `png_write_end'
writepng.o: In function `writepng_cleanup':
writepng.c:(.text+0x6c4): undefined reference to `png_destroy_write_struct'
writepng.o: In function `writepng_error_handler':
writepng.c:(.text+0x701): undefined reference to `png_get_error_ptr'
collect2: ld 返回 1
我安装的 libpng是libpng-1.2.25,是不是那里还要配置一下,
望各位大虾指点。谢谢……
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙
送出感谢: 4 次
接收感谢: 256 次

#2

帖子 eexpress » 2008-03-21 22:10

看着像编译的头文件,没包括在编译参数里面。类似`pkg-config --cflags --libs libpng`这样的?
● 鸣学
snail.chenhuabin
帖子: 22
注册时间: 2008-03-17 17:07
来自: 江苏苏州
送出感谢: 0
接收感谢: 0
联系:

#3

帖子 snail.chenhuabin » 2008-03-27 14:56

问题以解决。
回复

回到 “归档贴”