File editing help!

Pages: 123
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.


I agree Alexander; I used to use Dev-C++ when I was a beginner because it was really easy to make single-.cpp programs w/o project files. I would practice one concept in C++ at a time, and make plenty of small programs as practice, which you should do too. I still make plenty of single-file programs today as small utility programs to help with repetitive tasks/tools.

But I eventually uninstalled Dev-C++ because I found it's easier to just compile single-.cpp programs from the command-line -- you can either use make or write your own simple script that calls (g++ -Wall (filename}.cpp -o {filename}) for example. And IDEs like Visual Studio or Code Blocks are easier to create actual complex projects in, as others have already mentioend. There are also plenty of text editors to choose from that aren't full IDEs. like Notepad++ (basically an upgraded Notepad), or Vim/Emacs (these have lots of features but also have a learning curve).
Last edited on
Thanks, I hope the rude replies have ended, I hate when some idiot takes out his
anger about real life on someone online.

I will try making a .cmd/.bat to compile with, thanks.





Romans 10:9!
Alexander123 wrote:
Romans 10:9

Jesus is a faggot you fucking retard.
I'll pray for you, dutch. God bless you!
Proverbs 19:20
I hope God changes your mind, you'll regret this either way, though.
Lol go ahead, report me, I don't care.
I'm used to people hating what I say.
But, to be honest, I don't care.
Alexander, a good life lesson to learn is, "Don't feed the trolls."
Last edited on
Thanks, I'll remember that.
Last edited on
[Deleted]
Last edited on
Come quickly Lord Jesus!

Said the actress to the bishop.
Topic archived. No new replies allowed.
Pages: 123