How can I set up the g++ compiler independently of Dev-C++?

N_350Z

In Runtime
Messages
205
After weeks I finally got a book on C++ and last night I was reading it and it stated that you could set up the g++ command line compiler if you had Dev-C++, but now I can't find it. And I figured that learning how to compile on the command line could be valuable before I start to get in too deeop. So could someone tell me how?
 
Quite frankly, I don't see why. But, if you have Dev-C++ it is already installed, just change directory to the executable under a command prompt and make the appropriate statement. You'll need to look up whatever switches are appropriate for your case, but generally "g++ -o myfile.exe myfile.c" will get it done. Which brings me to other things.
The Dev-C++ IDE has excellent facilities for doing the same thing without the muss and fuss. It is already set up so that typically, with the right selection of project type, your project(s) will compile and link flawlessly. I hope this quick run down helps, though IMHO, you're going backward rather than forward here.
 
true... it is backwards rather than forwards...

but with a good knowledge of how the GCC compiler works from the command line then he only needs take the compiler and libraries with him, which, don't need to be installed in the same way that an IDE to interface with the tools does...

also he may find himself in front of a console in the future where there are no graphical tools only command line access. (such as ssh to a linux server).
 
Okay, root, I'm not saying it is a bad thing here to know the command line, but I will say these two things. First, if you are going to be doing any actual programming on Linux or *nix in general, yes, the command line is useful but editors and IDEs exist for *nix as well and are usually installed. Second, I merely meant that it is usually easier in the beggining to allow the facilities in a good IDE to do there job while you learn the language and the other nuances of programming than to worry about the proper switches to use with each type and variation of project. Perhaps others tend to teach in a different order. Please, don't take my comments as gospel or judgement, but only as expression of my surprise at something out of line with my experience, that's all.
 
I think it would be useful to know how to compile from the CL before I get too used to any IDE's. Knowing how to do that can't hurt in the long run.
 
You can probably set up the compiler on the CLI (ie make it executable from anywhere), by adding something to your system environment variables.

You only need to ensure you've got the environment variable set up, and then you can run g++ <args> from anywhere on your system just by opening up Command Prompt. Providing you don't change the area in which you store the default libraries and headers etc., this should work just fine.
 
learning how to compile from command line might not be as helpful as you think. learning the arguments and what a compiler can do might be what you're after. i don't think your ability to compile via commandline is going to have a dramatic effect on your coding ability.

http://gcc.gnu.org/

i think you learn the same amount of the langauge if you code in notepad (some other random text editor such as emacs, vi, or pico / nano) or an IDE such as dev-c++.
 
Back
Top Bottom