Reputation: 1885
I am fairly new to C++ and this might sound like a very dumb question, but is there any resource or common practice to find the headers that need to be included when using C/C++ libraries?
For example: I am currently doing a project using the OpenSSL library. How do I find out which headers I need to include for the sample codes on this page:
I had this issue many times and I am almost always struggling to find the right header files to include if the documentation doesn't provide a full working example.
Am I missing smoething when it comes to finding the required header files or is this lack of documentation the norm for examples?
Upvotes: 3
Views: 661
Reputation: 1079
I am aware that you were hoping to find something like a fancy database or any secret documentation to get the header.
Like for the Qt framework
in the Qt Creator
would be positioning the cursor on a written class in the code and just pressing alt
+ enter
is adding the necessary header on top of the code.
Sadly that functionality is just for Qt
not for c/c++
implemented.
The correct answer to your question might be as simple and maybe basic as so and it is also the fastest way I found and probably most people use:
EVP_PKEY
)c++
, Qt
, ...)Proof of concept f.e. for startpage.com:
Maybe https://en.cppreference.com/w/cpp/header is an alternative - I just never found stuff real quick there.
The second best option I found and use regularly to find in addition to the header even good sample codes/examples is a program called Recoll (For Linux, Mac and Windows - or a similar desktop search engine)
Recoll is based on the very capable Xapian search engine library, for which it provides a powerful text extraction layer and a complete, yet easy to use, Qt graphical interface. (https://www.lesbonscomptes.com/recoll/)
It works like that:
c++
, c
, qt
- just stay really specific) and let recoll crawl the folder.EVP_PKEY
to find every topic in all of your most loved and respected pdf c++
books in nano- to milliseconds - depending on how much money you spend on your pdf library. (Sure, you have to get/buy them first)(But its a freaking fast tool and even prioritized due to the Xapian search engine library)
Upvotes: 1