From: Earnie <ea...@us...> - 2011-02-04 18:21:53
|
Raffaello D. Di Napoli wrote: > 2011/2/4 Jonas noLastName wrote: >> g++.exe The most recently installed version of the C++ compiler frontend. >> mingw32-g++.exe The most recently installed version of the C++ compiler frontend for the mingw32 target. >> gcc.exe The most recently installed version of the C compiler frontend. >> mingw32-gcc.exe The most recently installed version of the C compiler frontend for the mingw32 target. >> mingw32-gcc-4.5.0.exe The 4.5.0 version of the C compiler frontend for the mingw32 target. > > gcc is just the C compiler, g++ is the C++ compiler. It’s like you’re > asking why there are both mspaint.exe and wordpad.exe…they’re just two > different programs. > > >> My questions are: >> 1. Why is it like this ? >> What is its purpose ? > > The C (and the C++) compiler’s file name can include the target it > will generate code for. In your case, your only installed target is > mingw32, so all you see are these mingw32-*.exe files. Had you also, > say, a toolchain (which includes a C compiler) targeting > i686-pc-linux-gnu, you’d have more of these files, all prefixed with > i686-pc-linux-gnu (for example, i686-pc-linux-gnu-gcc.exe). > > Also, in some cases you might want two versions of the same compiler, > for the same target, for compatibility reasons. How would you > distinguish them? The answer is to have the version included in the > file name, as in *-4.5.0.exe in your case; the version-less file name > will then be a copy/hardlink/symlink of one of these file (presumably > the one you’ll use most often), for the cases where you don’t care > much which version you’re actually using. > > For example, if you know some program only builds with GCC 3.x, and > you have both mingw32-gcc-3.4.5.exe and mingw32-gcc-4.5.0.exe, and > your mingw32-gcc.exe is actually the 4.5.0 one, you will want to > invoke make on it with > make CC=mingw32-gcc-3.4.5 > so as to tell it to use the older compiler. > > Very clear description. >> 2. Which file do i use ? > > Of course, many people don’t need all of the above. When you just want > to compile for whatever system you’re on, using whichever compiler > version is the default there, you just use gcc.exe (or g++ for the C++ > compiler); that will be the “native” compiler, which is what most > people want when building programs on their own systems. > You will probably need them but use only gcc or g++ as appropriate. Most Open Source packages use autoconf to configure the packages and will choose the appropriate frontend based on the target specified to it, if any and if not specified will choose the generic frontend. > > I hope that helps, and that I didn’t slip too many inaccuracies into this :) That others might help with. -- Earnie -- http://www.for-my-kids.com |