On 25/07/16 16:14, BartC wrote:
> On 25/07/2016 12:31, David Brown wrote:
>> On 22/07/16 23:18, BartC wrote:
>>> On 22/07/2016 18:29, The Doctor wrote:
>>>> Which is the better compiler?
>>>
>>> My experience of using Clang is that it is not complete: it assumes a
>>> gcc installation (so that it can make use of gcc's header files and
>>> possibly libraries too).
>>>
>>> So if you could only install one, gcc would make more sense...
>>>
>>
>> If you are using an OS that does not include basic OS headers and
>> libraries, then you will need to install those along with your compiler.
>
> Huh? How is a beginner supposed to know anything about that? They will
> expect a C compiler to come with everything needed to compile C programs
> into something that can be run.
I have no idea what /you/ are supposed to know about. I /do/ know that
most OS's include assemblers, linkers, libraries, and headers (and
usually compilers too) as part of their basic packaging - Windows is
fairly unique in not doing so. I also know that some compiler
manufacturers - gcc and clang being prime examples - make compilers, not
development suites or even complete C implementations.
It is such a long time since I was a beginner with C that it is hard to
be sure how someone might approach the issue. But I would imagine that
someone starting with a bare Windows system who wants to use clang for C
compilation would first start out by googling. It should not take long
to see that clang is distributed as part of modern MS Visual Studio, and
that would seem like the easiest way to get the compiler along with an
IDE, headers, libraries, etc. Other suggestions that come up quite
quickly are instructions for compiling llvm and clang (presumably your
scared newbie would skip those), and projects like msys2 (which will
include all the other bits and pieces needed).
Newbies with any most other OS's would simply look up clang with their
distribution's package manager, and that would install any missing files
or programs automatically.
>
> Pelles C includes everything. lccwin32 includes everything. Digital Mars
> C includes everything. Tiny C includes everything. The MSVC I bought
> years ago including everything.
Those are not compilers - they are development suites of which a
compiler is one part.
Now, it is an understandable mistake to think that clang or gcc are the
same sort of thing as these tools - but it is a mistake. Their
websites, or at least their "getting started" information could no doubt
be more helpful here.
>
> Until you come to gcc which just has to be different, just to make life
> simpler for everyone!. But even there, if you've chosen the right
> download package, everything needed is also there.
>
> And then you come to Clang (for Windows, as are all my examples). Which,
> for a start, gives no indication whatsoever that it does have a dependency.
>
> Nor that that dependency is on anything other than specifically gcc.
> Very puzzling after you've completed a 400MB installation; surely that
> lot must have included everything /including/ the kitchen sink!
>
> If I 'hide' my gcc installation, then Clang stops working. Despite there
> being four other C compilers around.
>
>> Neither clang nor gcc provide these. There are /packages/ for Windows
>> that include gcc, headers, libraries, an assembler, linker, and other
>> useful utilities. If there are no such pre-made packages for clang for
>> Windows, then perhaps installing a gcc package first is a convenient way
>> to handle installation of clang on Windows. Remember, gcc and clang are
>> compilers - they are only /part/ of a C (or C++) implementation.
>
> Blah blah ... No beginner wants to know about this stuff. They want
> something that Just Works. They are not interested in the fine
> distinctions between a compiler, includes, libraries and utilities.
I am not trying to sell you anything here - I am just telling you the
facts. If you want to campaign on behalf of all these "beginners" who
want to program in C on Windows, specifically using gcc or clang, and
want something that "just works", then feel free to do so. I should
expect you could put together binary packages for clang and gcc, along
with libraries, include files, a debugger, and an IDE, all within a
single installer file. I don't even think it would be a huge effort
(though testing it all on different versions of Windows might be a
pain). But please stop making it look as though this is the fault of
gcc, or the fault of clang, or fault of people in this newsgroup.
>
> Even a non-beginner who has spent years using integrated packages would
> be surprised that some compilers are split up into separate parts. (Like
> buying a new car but having to source the engine and the wheels
> separately. And not actually being told that so being surprised because
> you're used to cars having those included.)
>
>> However, the OP is posting from a *nix system - FreeBSD, according to
>> the post's headers. He will therefore have all the headers and
>> libraries he needs, either installed already or just a "pkg install"
>> away.
>
> In that case he's got no problems because Unix users like to have their
> hands held (the opposite to what is usually claimed).
>
*nix users usually like convenience as much as any other users. I
/have/ compiled gcc from source (for a number of different target
processors), as well as finding, building and installing the appropriate
libraries and headers. But it is a lot faster and easier to use
ready-made packages when they are available.