编译包含ext2fs.h的文件(Compile file which includes ext2fs.h)

编程入门 行业动态 更新时间:2024-10-25 18:29:48
编译包含ext2fs.h的文件(Compile file which includes ext2fs.h)

所以我正在编写一个包含/extfs/ext2fs.h的C文件。 我试图调用函数ext2fs_open()。 我可以清楚地看到头文件ext2fs.h具有该特定功能。 事实上,如果我传递了不正确的参数数量,它甚至会纠正我。 但它不编译,总是给我一个“未定义的参考”错误。 这个问题在于头文件中定义的所有方法。 我该如何编译这个文件? 有什么图书馆我需要链接到?

谢谢。

So I am writing a C file which includes /extfs/ext2fs.h. I am trying to call the function ext2fs_open(). I can clearly see that the header file ext2fs.h has that particular function. In fact, if I pass in the incorrect number of arguments, it even corrects me. However it does not compile, always giving me a "undefined reference" error. This problem lies with all the methods defined in the header file. How am I supposed to compile this file? Is there some library I need to link to?

Thank you.

最满意答案

你需要链接到libext2fs ,是的...

gcc -I/dir/containing/ext2fs.h -lext2fs your_source.c -o app

You do need to link to libext2fs, yes...

gcc -I/dir/containing/ext2fs.h -lext2fs your_source.c -o app

更多推荐

本文发布于:2023-08-08 01:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466758.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   ext2fs   Compile   includes   file

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!