How to convert Text File to C/C++ File to include folder

Recommended Answers

All 2 Replies

A header file is a text file. Just plain text.

If you have a text file that you want to use as a header file, make sure it's correct C++ code, name it something.h, and then put it somewhere sensible, like next to your cpp files or in a separate headers directory.

As Moschops said, and also there are other extensions that are typical for header files, especially .hpp (the .h is conventionally reserved for C headers). For the rest, header files are just plain text files, like all other types of C++ source files too (cpp files are also just text files). This is true of nearly all source files in all programming languages in general.

If you have trouble with understanding the C++ compilation process, I suggest you read my comprehensive tutorial on that subject.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.