找不到libpng16的符号
gcc编译
gcc -o encode encode.c -lavcodec -lavutil
报错
/usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_IHDR@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_get_io_ptr@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_longjmp_fn@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_PLTE@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_write_info@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_create_info_struct@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_write_image@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_write_end@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_create_write_struct@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_write_fn@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_tRNS@PNG16_0' /usr/bin/ld: /lib/x86_64-linux-gnu/libzvbi.so.0: undefined reference to `png_set_gAMA@PNG16_0'
pkg-config libpng16找到libpng16所在目录
$ pkg-config libpng16 --cflags --libs -I/usr/local/include/libpng16 -L/usr/local/lib/x86_64-linux-gnu -lpng16 -lz
设置LD_LIBRARY_PATH,然后编译:
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH gcc -o encode encode.c -lavcodec -lavutil
或者直接-L参数,指定lpng16就可以:
gcc -o encode encode.c -lavcodec -lavutil -L/usr/lib/x86_64-linux-gnu/ -lpng16
指定-L/usr/lib/x86_64-linux-gnu/ -lpng16可以解决上面的问题。
猜你喜欢
网友评论
- 搜索
- 最新文章
- 热门文章