use some functions from e2fsprogs

use argments

When we want to use some argments from source program to our program, if the argment define to simple, like “int arg;” you just find and copy them from source program,

custom data type

and if the argment have a custom data type such as “ext2_filsys”, and the data type is not in the source program, it is maybe **in certain header file or another program,**so,you have to do $find . -name “*.h” -print | xargs grep ext2_filsys , and check the header file of output, to find the ext2_filsys and maybe it is a struct, so,just copy whole defination,

and maybe the argment is in another program file, you have to do $find . -name “*.c” -print | xargs grep ext2_filsys, to find define ,and just copy

shell file

if there have shell file named is xxx.sh
and there have some command in shell file like “gcc -o xx xx.c”
so ,when we build the progarm we do $sh ./xxx.sh

underfined reference sth from .a file

and in the shell file we do the gcc things ,and if we had some error in the terminal like “/usr/bin/ld: 39.c:(.text+0x325): undefined reference to `com_err’”,
we should go to the build/lib direcotory and do *$nm .a | com_err, to find which .a file has the com_err

and when we find the .a file ,add the file path to the shell file like “gcc -o xx xx.c ~/Downloads/path…/build/lib/libext2fs.a

lack of library

there has another case:
error in terminal like “/home/llxy/Downloads/e2fsprogs-1.46.5/build/lib/support/…/…/…/lib/support/plausible.c:241: undefined reference to `blkid_get_cache’
and we find there is no .a file include blkid
so, it’s time to seek help from google, and we found it is a library named “blkid”, so add the -lblkid to the shell file.
notice! -lblkid must after .a file ,like “gcc -o xx xx.c /home/llxy/Downloads/e2fsprogs-1.46.5/build/lib/ss/libss.a -lblkid

linux gcc command

gcc -I diretorypath

means: Specify additional header file DIRECTORY search path.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值