Tutorial on handling C++ files?

When it comes to saving the workspace, project, and file, I'm really at a loss as to how all this works. I was doing a walkthrough of one guide that had me create multiple .cpp files, but when I did so under the same project, it kept running the same file each time even when that one wasn't open.

I'm also not sure how we can move these files around without issues coming up where it can't locate them (if that is even possible after creating them).

I've read some information on the web about the difference between the file types, but nothing in particular that explains why I was having the issue of not being able to run various .cpp files under the same project (and why one of them became a default that always seemed to take over).

If anyone knows of a good tutorial on how to handle these files and folders, I would greatly appreciate it. Thanks.
You'd be best to read the full free tutorial on this site, as your issue stems more into the basic usage of the language.

Generally you'd create a header file with the class deceleration (.h) and then a code file for c++ (.cpp). The .cpp will include the header. If it is anticipated to be included multiple times in one scope then provide a statement to avoid this in the form of a header guard or as I do (#pragma once) at the top of the header file. The code file is where you put the definitions and initialise all of the static varibles both declared in the header file.

To avoid it dealing with multiple instances either instantiate your file handler in a global scope such as a static class member variable or have your open file context objects stored statically centrally.
Ok, thanks for the information. I think I get what you're saying and am going to experiment a bit. I looked through the tutorials on this site, but I didn't have any luck finding information about this topic in particular. Maybe it is just in there somewhere that I'm overlooking.
Topic archived. No new replies allowed.