This is the mail archive of the
mailing list for the GCC project.
Re: [i386] Why g++ _always_ link an executable with libm.so?
On Tue, Jan 04, 2005 at 11:30:05PM +0100, Gabriel Dos Reis wrote:
> Denis Zaitsev <email@example.com> writes:
> | a) why g++ assumes that libstdc++ is always needed?
> Because that is the way it is designed. If you don't want libstdc++,
> say -nostdlib as explained in our documentation.
This doesn't work out of the box... But yes, it can be a solution,
> | b) why is libm _always_ needed by libstdc++?
> Because libstdc++ needs the mathematical functions.
> | It's rather strange.
> I guess it is a matter of perspective. From my part, requiring users
> to explicitly supply -lm is a bug. Simply because the mathematical
> functions are part of the standard library; we do not require users to
> say -lstr when they use strcpy() and friend; we do not require users
> to say -lstdio when they use fprintf() and friends. YMMV.
Ok, but do we force users to use libm every time libc is used? No, we
don't. Of course, we don't. And I emphasised the word 'always':
not _every_ routine from libstdc++ need libm, but it always
Anyway, could anybody say, where in sources these NEEDED libraries
come from? If I was going to patch this just for my installations...