sometimes it's needed, MOST TIMES! |
This statement is actually false.
Again, you, and admitted beginner, are trying to tell experts how something should be done. Instead, you should read the experts' advice and try to learn what you don't understand.
The ability to compile just a single .cpp file is meaningful in only 2 ways.
1. You are writing single-file programs. If this is the case, that won't be an issue much longer. To do anything significant, you will find yourself needing multiple files. Period. Trying to write a video game, for instance, using a single .cpp--while theoretically possible--would be extremely complex and cause you many headaches down the road. In addition, if you have to link in external libraries to complete your build, sending those library files to the linker (and if you don't know what a linker is, you need to read about the C++ compile/link process) is done a whole lot easier with a project than via a command line.
2. You have a multi-file project and you only make changes to a single file. In this case, it is possible to recompile a single file that you might change. There are benefits to compiling this file by itself to work out compilation errors (and you can do this through most if not all IDEs), but this is done less frequently than you might think. And, when you are done, you need to re-link your project with the new object files you compiled. In this case, a project helps you out a lot.
Freaking out about needing to create a project to build a single file is directing your focus on the wrong issue.
When working in a Linux environment, I tend to use command line tools (gvim as an editor, g++ for build tools), so I don't have an IDE's project to store things in. However, I do use Makefiles extensively. Makefiles act similar to an IDE's project, but without the GUI and the bells and whistles.
As soon as I get 2 or 3 source files into an exploratory project (usually no more than an hour or so), I create at least a rudimentary Makefile. When a project reaches a threshold where it is not just exploratory but something that may become a real project, I copy, paste and edit a more robust Makefile from a previous project and go with that.
When I program in Windows, I create a new project immediately, or, as @jlb suggested, I reuse a dummy project created for exploratory programming. Easy peasy.