Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Enhancement: Header to Include to get Class/Function #152

Open
cwfitzgerald opened this issue Jun 14, 2018 · 6 comments
Open
Labels
good first issue Good for newcomers type: enhancement [MINOR] Feature that doesn't take more than a few days to implement
Milestone

Comments

@cwfitzgerald
Copy link
Contributor

It would be very beneficial if the documentation would have something to tell you what to include in order to use that thing. CLion/Visual Studio should be able to find the symbol, but it would be a boon to anyone who is using a less advanced IDE.

@nemerle
Copy link
Contributor

nemerle commented Jun 14, 2018

Qt has done pretty interesting thing, and created a bunch of very simple include files for most of their classes, for example a class named 'QString' has a QString include file with

#include "qstring.h"

as it's only content, so users know that they can #include <ClassNameIWant> and they usually get what they need.

@cwfitzgerald
Copy link
Contributor Author

That might be interesting as a way of unifying includes, but I seem to remember @BearishSun not wanting to separate out includes/source anymore because of how much of a pain it was to maintain two trees. I feel like this would fall under the same problem.

Either way, the docs should list it.

@BearishSun
Copy link
Member

I think most bsf files adhere to the BsCLASSNAME.h naming of the headers. But since everything got moved in sub-folders by category that is kinda irrelevant since users need to guess the folder names now.

I'm pretty sure Doxygen has an option to enable this but I'm not sure what it is at the moment. I'll take a closer look when I get more time.

@BearishSun BearishSun added this to the Longterm milestone Jun 14, 2018
@BearishSun BearishSun added good first issue Good for newcomers type: enhancement [MINOR] Feature that doesn't take more than a few days to implement labels Jun 14, 2018
@s0sharma
Copy link

s0sharma commented Aug 4, 2021

Can I try this ?

@jonesmz
Copy link
Contributor

jonesmz commented Aug 4, 2021

You will want to look at this issue first #418

@sahilbheke
Copy link

To use a class or function in C++, you need to include the corresponding header file that contains the class/function declaration. The header file typically has the same name as the class or function with the extension ".h" or ".hpp".

For example, to use the string class and its member functions in C++, you would include the header file in your source code like this:

#include <string>

int main() {
  std::string str = "Hello, world!";
  // Use string member functions here
  return 0;
}

Similarly, if you have defined your own class or function in a separate header file, you would include that file in your source code using the #include directive. For example, if you have a file called "myclass.hpp" that defines a MyClass class, you would include it like this:

#include "myclass.hpp"

int main() {
  MyClass my_obj;
  // Use MyClass member functions here
  return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: enhancement [MINOR] Feature that doesn't take more than a few days to implement
Projects
None yet
Development

No branches or pull requests

6 participants