From: LRN <lr...@gm...> - 2011-11-28 16:57:00
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 28.11.2011 18:49, Solomon Eraut wrote: > It seems like learning a programming language is going to take thousands of hours, so every time there's another detour that could take a thousand hours itself, and it wasn't something I CHOSE to invest time in, I cut it short to an hour if I can. As others have pointed out, you need an IDE, which will provide a practically single-click (well, a few-click, maybe) solution for software building. That's the name of the problem you have - software building. There is a difference between learning a language, and learning the tools involved in writing programs. IDE would be good for you, since it either replaces some of the tools with its own integrated-and-generally-easy-to-use self, or hides them from you, running them by itself behind the scenes (which is the same thing, from your point of view). Also, tutorials for IDEs are simple to follow. Give `Code::Blocks' a try, or maybe `DevC++'. Maybe Eclipse (not sure if it can use MinGW toolset). Haven't been using IDEs for a while, so can't really help you to choose. You might also be able to find books or tutorials that explain not only the C language, but also how to invoke compiler and linker, etc, from command line. Sadly, i can't remember any. Other problems you have: Editor - you can use any text editor. I prefer Far Manager, but absolutely any editor will do, if it is capable of working with UTF-8-encoded files (that is, Notepad, Wordpad, and office applications are generally unsuitable for this). Obviously, a text editor with syntax highlighting is preferred, and IDE will provide that, if you choose to use it. Some kind of "programmer's notepad" would suffice. Or you can use `vim' from command line, but that would be very hardcore. Program appears for a second, then disappears - this is the normal behaviour of a command-line application. I assume that you're running it by double-clicking it in Windows explorer of some kind. Windows sees that application is a command-line one (linker guessed that at link stage, since you have main() instead of WinMain(), i think), and creates a new console for it, which disappears once the application finishes. Normally i would run the compiled application from the same console i used to compile it (that would be MSys shell, bash, that is), in which case the application will keep using that console instead of creating a new one, and you'll see the output there, after the application exits. Other places to invoke gcc from - technically, you can invoke gcc from normal Windows command prompt (that is, assuming that you've added mingw/bin directory to PATH, otherwise Windows won't be able to find gcc; MSys shell initialization script does the PATH magic for you, which is why it just works there), and that would be fine for simple "use gcc to compile an application that consists of one source file" educational scenarios. However, if you start to write applications that have more than one source file, you'll realize that you need a way to automatically invoke gcc (and other tools), instead of doing it yourself (because at best you'd have to invoke gcc once for every file). Traditional way is to use makefiles and the `make' utility. In Msys shell you can use `make', outside of Msys shell (in Windows shell) you can use `mingw32-make'. And that will work just fine, until your project gets bigger, and you'll realize that writing makefiles is tedious, and that juggling the many compiler and linker options is mind-nubbing. At which point you have a few options: 1) Use IDE, because IDE often allows you to not to use makefiles. 2) Use non-make building tools (`scons', `CMake', `ant', and so on) 3) Use autotools, which is the traditional *nix way. And for autotools you need MSys, because autotools require *nix shell (such as bash). Considering the fact that LOTS of free/opensource programs, especially the ones originating from *nix, use autotools, it means that compiling them absolutely requires MSys shell. Which is kinda the point i've been trying to make in this paragraph. So to answer your question: yes, you can use gcc outside of MSys shell, as long as you're using only [simple/pre-made] makefiles or non-make building tools, which do not require MSys shell. As i have said, learning the tools has little to do with programming. For the record, i've learned programming using IDEs (for Basic, Pascal, and C), and only after that i've switched to using command-line tools, like `gcc', `make', autotools and such. Oh, and sending directly to the list is fine, that is exactly how it is supposed to work. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJO071KAAoJEOs4Jb6SI2Cw+pgH/je/F3ll0YSqLBsGC1Ppi/3y zI5chpRsn7usRevuBiGay5fk+doVRGyz1VGFp89Xn7+yvzIC4MyXMXv9Al399SKZ Aziu7JkmkD2kLVV85RoFPglUVPjtrU2qXcy5DElnoJyByeEKO4OQGwkTQqNgkXBp JYEryoH2xXTKh4gZWnFUPFR/JTrDBp1FF4RrFRvshHXBShHD27QbYdnWKnoQwUbD GoqYjEum2dpprZhWkkaX7D/CC9zo9cDDfieYyi8TwBDKSDBCFfFZL2W3kUbf2vMV FlJx0yPBkomf1BQnD6zQ4WvvDBK+J7+H/gF0YLL/vCIVeFfDlhtdt8lYRjrkafQ= =6MJg -----END PGP SIGNATURE----- |