Thread: How do you find header of a function?

  1. #1
    Registered User
    Join Date
    May 2006

    How do you find header of a function?

    Lets say you see a function whose code isn't provided in that file and is probably in one of the headers. How would you go about figuring out which header that function belongs to. Obviously you can just look in every single header included one by one but I would think there is a faster way?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    You look in every single header file included, one by one.

    Unless you have documentation for the function, or are a good guesser.

    And for that matter, the function wouldn't be defined in the header anyway, just the prototype for the function. (If that's all you want, then fine; if you want the source, you might be in trouble.)

  3. #3
    Registered User
    Join Date
    Oct 2008
    If it's one of the Unixes use a combination of find and grep commands to do the work for you and isolate the header file where the function is declared.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Toronto, ON
    If you're using Visual Studio, you can usually right-click on the function name and choose "Go to Definition" or "Go to Declaration".
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    If you're using TkCodex, it should be easy -- but if not, you can always check with me, the author
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. Confused with function header
    By diddy02 in forum C++ Programming
    Replies: 4
    Last Post: 11-27-2006, 08:02 PM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM