is there any way to find the methods in header file?

In perl through "symbol table" we can find all Methods in a package/module.
Likewise is there any way to find all methods in c++ header.

ex:
#include<time.h>

I would like to find all available methods in this header.

Thanks in advance.
That really depends on which IDE you use. It is the task of an IDE. In Visual C++ you can right click and open the file and look at all the content and search for the methods. You can also try to find the file by hand.

Also, since it is a standard C++ header, it should have documentation online so you should be able to get all available methods which the standard demands.

Anyway, what you are able to do with the header files you include depends on your IDE.
If I understand you correctly,
This is not a feature of the language. It depends on IDE you're using.
Though, I suggest you simply go to the reference on this site:
http://www.cplusplus.com/reference/clibrary/ctime/
Also, the "symbol table" from 'perl' would also be done by the IDE you used. perl and C++ are only the code you can type.
It's like, English is the language, that describes how you can talk in English. A dictionary would be a tool to see what words mean what. And jsut like that, C++ is also a language, it describes how you can make an application, an IDE would be a tool to help you with doing that.
Last edited on
C and C++ do not have introspective powers.

If you want to know what is in a header file, just open it up in your favorite text file reader and you will see all the function prototypes listed. Standard headers often #include other files too, so you may have to look through more than one file.
Isn't better to read the documentation of the header/library as hamsterman said?
I use Doxygen for that. It produces cross linked html documentation, so you can follow code by just clicking on the link.
Thank you for all for your kind response.
To further elaborate: the file could be ran through a third party tool to generate the information you need. For example, IDEs often use Ctags or Exuberant Ctags to generate a symbol table, which it then can use to provide intellisense-style completion. Doxygen creates an HTML reference from this information.

Personally, I recommend viewing the headers for any class, function, library that you use. My rationale is simple: 1) it is accurate (possibly more-so than the documentation) and 2) this is a skill that a software developer absolutely cannot do without.

I can't even count how many times a class/library has been used poorly, then copied and pasted by another developer, and so on. The copy and pasters are not familiar with the provided interface because they have not looked at it for themselves.
Last edited on
But reading the headers themselves may be a distraction since they show more than you need to know.
Most libraries are well documented. The standard library has lots of places in which it's explained
Documentation is for the documented stuff in header files, and the OP asked "to find all available methods in this header." :-)

I very much agree with hamsterman and Bazzy that you stick to using the documentation.



The error being made here, I think, is confusion between runtime reflection (and introspection) and the available programmer's API, which can be found (in C and C++) in header files and documentation.

C and C++ do not have any built-in way to perfrom runtime reflection. (There are some very sophisticated C and C++ libraries, such as Valgrind, that supply some reflective powers, but they are limited in what they can do.) [There are also symbol tables in the PE32 format, but they are useless to you for what you want.] Various object - type systems can supply some simple introspection as well, but every object you create needs to derive from the base class.

The programmer's API is very complete and, in the case of C and C++, very accurate. But again they presume that you are using them before your program is executed. This is where your thinking needs to occur - before compilation.

Good luck!
SGI has a list of that stuff. http://www.sgi.com/tech/stl/
It's probably about equal to what we have here, in the reference section.
Topic archived. No new replies allowed.