What is the difference between the .cpp and .h? What do you put in each one?
I would recommend looking up C++ tutorials before you start with unreal c++. Learn to use C++ by itself by downloading Visual Studio or another IDE and learn standard C++ before you start with unreal engine’s C++.
That being said, the answer to your question is:
The .h or .hpp files are header files that usually are used for the declarations of the classes, functions and variables that are used in a program. The .cpp or .cxx files are the implementation of the functions and classes that were defined in the .h files.
For example, in the .h file you have a class definition of “myClass”. This class has two functions “funcA()” and “funcB()”. This is a promise that the objects of the type myClass will have the two functions mentioned above.
You include the .h files into various .h files or .cpp files so that the classes inside those files can know about our class “myClass”. Once we know about it we can use it.
So, in short, .h files are the blueprint or recipe of your class and they are used to connect your classes, and thus your program, together. The .cpp files are the actual implementation of the promises made in the .h files and is where the actual execution happens.
Hope this helps. However, go look up tutorials on youtube or on google and learn C++ before you dive into UE4 C++.
Thanks for the reply! I know the question was kind of vague, but I was just curious what they were for. I’m trying to learn C++ with unreal engine because I thought learning that way would be more relevant to what I want to use C++ for, but I will taking your advice. Thanks again!