所以我正在编写一个包含/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 appYou do need to link to libext2fs, yes...
gcc -I/dir/containing/ext2fs.h -lext2fs your_source.c -o app更多推荐
发布评论