[QUESTION]使用hlfs API的编译问题

2 views
Skip to first unread message

Zhen Ren

unread,
Jun 7, 2013, 3:47:48 AM6/7/13
to Harry Wei, clo...@googlegroups.com
想写一个简单的程序,使用下HLFS的API,程序代码如下:
#############
  8 #include <stdio.h>
  9 #include "hlfs.h"
 10 
 11 int main(int arg, char *argv[])
 12 {
 13     struct hlfs_ctrl *ctrl;
 14     struct hlfs_stat stat;
 15 
 16     ctrl = init_hlfs_by_config("./hlfs.config");
 17     
 18     hlfs_stat(ctrl, &stat);
 19 
 20     printf("hlfs name: %s.\n", stat.fsname);
 21 
 22     return 0;
 23 }                                                                                                                                          
##############
编译过程:
1.添加HLFS的头文件,glib2.0头文件,如下

$ echo $C_INCLUDE_PATH
/usr/local/lib/hlfs/include/api:/usr/include/glib-2.0:/usr/lib/i386-linux-gnu/glib-2.0/include


$ echo $LIBRARY_PATH
/usr/local/lib/hlfs/lib

3.编译命令如下

$ gcc test_init.c -o test.out -lhlfs

但是在运行test.out是出错了:
$ ./test.out 
./test.out: error while loading shared libraries: libhlfs.so: cannot open shared object file: No such file or directory

thanks! (:
--
Ren Zhen

harryxiyou

unread,
Jun 7, 2013, 4:02:29 AM6/7/13
to Zhen Ren, clo...@googlegroups.com
链接动态库失败,看看/usr/local/lib/hlfs/lib下面是否有libhlfs.so

--
Thanks
Harry Wei
Reply all
Reply to author
Forward
0 new messages