<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 19, 2013 at 3:38 PM, Ritesh Ranjan <span dir="ltr"><<a href="mailto:r.ranjan789@gmail.com" target="_blank">r.ranjan789@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I keep getting "implicit declaration of <some function>" error quite<br>
often. So I'm assuming I am not adding the correct header files when I<br>
am writing the module.<br>
<br>
eg. I wanted to create a kernel thread using<br>
ktheard_create/kthread_run, but couldn't find which header to include.<br>
While I was looking for solutions I stumbled upon ctags. It mostly<br>
gets the job done, but not always. I couldn't find the proper header<br>
to use for open(inode,file); even though ctags pointed me to<br>
<linux/fs.h>, I still get the implicit declaration error.<br>
<br>
Is there any way of finding exactly which headers to include when one<br>
is trying to use a function? A detailed explanation would be really<br>
great.<br></blockquote><div><br></div><div>For the specific header:<br><a href="http://lxr.free-electrons.com/ident?i=kthread_run">http://lxr.free-electrons.com/ident?i=kthread_run</a><br></div><div><br></div><div>Generally, Ctags is pretty good at finding things. In case you're not getting the right def of a fxn, check the tag list in case there are multiple functions defined with the same name. I forgot the vi command (I think it was "ts" or "tl"), but it'll list down the various defs it found for the fxn. You can then navigate to the specific file of your interest.<br>
<br></div><div>HTH,<br></div><div>-mandeep<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div></div>