I'm fairly new to programming and have been learning for a few months now. I've decided to take on the challenge of creating a game using C++. It's quite difficult since I'm not very experienced, especially with the specific methods for handling variables and structures. I've set up my project with multiple files, like header.h and source.cpp, to help with organization and bug tracking. I'm wondering if there's a way to compile and run all my cpp files together so I can see how my game is taking shape?
6 Answers
What kind of game are you trying to make? If it’s something simple like Pong, you can definitely handle basic collision and scoring. But if you’re thinking about creating an engine from scratch, it can get super complex pretty quickly. For learning resources, check out the Godot engine; it’s open-source and written in C++, which might be pretty beneficial for you.
You should definitely look into using CMake! Although C++ doesn't have an ideal built-in system, CMake can help you manage your project by specifying which files to include in your build. It simplifies the process a ton! Just list your source files and let it handle the rest.
In your IDE, there’s often a play button that lets you run your program without needing to manually build everything first. Just hit that and give it a go!
It sounds like you have multiple cpp files but haven't compiled them together yet? You need to make sure all your source files are included in your build process. Most IDEs allow you to do this by adding all relevant files to your project.
Just a heads up, if you want quick results, Unity with C# might be an easier start in game development. It’s great for getting your feet wet, and you might find you enjoy the process more! But if you’re committed to C++, you can start by making your executable from your main.cpp, which should link to your other files correctly as long as they've been included properly.
You might want to consider using a proper compiler if you haven't already. That way, you can compile all your files at once and see how they work together.

Yeah, usually you start with a proof of concept and then refactor. It sounds like you've got the order a bit mixed up; just keep working on it!