【问题标题】:How to create pdf file in centos by using libharu如何使用 libharu 在 centos 中创建 pdf 文件
【发布时间】:2014-06-17 06:16:16
【问题描述】:

我正在尝试使用 libharu 库生成 pdf 文件,但我已经编译了它创建目标文件的代码,同时运行了它给出的可执行文件

错误如:undefined reference 'print_grid'

首先我导出路径:

export PATH="$PATH:/usr/local/lib/libhpdf.so"

并编译

gcc -c text_demo.c -o text_demo.o

gcc text_demo.o -L"/usr/loca/lib" -lhpdf -o "text_demo.exe"

【问题讨论】:

  • text_demo.c的内容是什么?

标签: linux gcc


【解决方案1】:

试试这个:

1) 确保您已将 libhpdf.so 实际安装到 /usr/local/lib 中

2) 编译链接:gcc -Wall -g text_demo.c -L/usr/local/lib -lhpdf -o text_demo

注意你确实不需要需要“exe”,你确实不需要需要多余的引号。

还要注意 $PATH 与您的共享库路径无关。这适用于 Windows; Linux 使用 $LD_LIBRARY_PATH。

3) 输入ldd text_demo

这会检查任何运行时依赖项

4) 最后,尝试运行您的程序:./text_demo

5) 请在构建、ldd 或执行期间复制/粘贴任何 EXACT 错误消息。

【讨论】:

  • 它仍然出现同样的错误 [root@hemanth demo]# LD_LIBRARY_PATH=/usr/local/lib [root@hemanth demo]# export LD_LIBRARY_PATH [root@hemanth demo]# gcc -Wall -g text_demo .c -L/usr/local/lib -lhpdf -o text_demo /tmp/ccjsFLyt.o: 在函数main': /home/hemanth/libharu-libharu-ec89be4/demo/text_demo.c:129: undefined reference to print_grid' collect2: ld 返回 1 个退出状态 [root@hemanth demo]# ldd text_demo ldd: ./text_demo : 没有这样的文件或目录
【解决方案2】:

需要安装 libharu 和 libharu-devel 包

请从这里找到适合 centos 5 或 centos 6 的软件包

http://pkgs.org/search/libharu

然后编译你的源代码

【讨论】:

  • 你安装了 libharu 和 libharu-devel 包吗??
  • 用这个命令编译 gcc -Wall -g -I/usr/include/text_demo.c -L/usr/lib/ -o text_demo -lhpdf
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-18
相关资源
最近更新 更多