Compile file which includes ext2fs.h
So I am writing a C file which includes /extfs/ext2fs.h. I am tryin开发者_如何学Gog 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.
You do need to link to libext2fs, yes...
gcc -I/dir/containing/ext2fs.h -lext2fs your_source.c -o app
精彩评论