public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21287] New: Problems while compiling with some math functions.
@ 2005-04-29 17:26 sreevatsan at gmail dot com
  2005-04-29 17:52 ` [Bug c++/21287] " pcarlini at suse dot de
  0 siblings, 1 reply; 2+ messages in thread
From: sreevatsan at gmail dot com @ 2005-04-29 17:26 UTC (permalink / raw)
  To: gcc-bugs

I am trying to complie a simple program with math functions sqrt() and fabs
using gcc 3.4.3  (Red Hat 3.4.3-9.EL4). I am not able to compile without
including #include <math.h> but same code works with earlier versions of gcc
3.3.3 (Suse ) and gcc 3.3.3 (Red Hat 3.2.3-42).

Code:
#include<iostream.h>
int main()
{
        double k =1.4;
        cout<<sqrt(k)<<endl;
        cout<<fabs(k)<<endl;
        return 1;
}

Compilation command: g++ -o main main.cpp -w

Error:

main.cpp: In function `int main()':
main.cpp:5: error: `sqrt' undeclared (first use this function)
main.cpp:5: error: (Each undeclared identifier is reported only once for each
function it appears in.)
main.cpp:6: error: `fabs' undeclared (first use this function)


I have a large piece of software that have code in this manner i.e, using math
functions without including #include<math.h> and would like to migrate to gcc 3.4.3.

Please do advice.

Thanks,

-- 
           Summary: Problems while compiling with some math functions.
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sreevatsan at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21287


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/21287] Problems while compiling with some math functions.
  2005-04-29 17:26 [Bug c++/21287] New: Problems while compiling with some math functions sreevatsan at gmail dot com
@ 2005-04-29 17:52 ` pcarlini at suse dot de
  0 siblings, 0 replies; 2+ messages in thread
From: pcarlini at suse dot de @ 2005-04-29 17:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-04-29 17:52 -------
Really, you have to include math.h: the ISO Standard that we are implementing
is *very* clear about that, sorry. Much better, please move to <iostream> and
<cmath> in namespace std:: take seriously the warning! Thanks.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21287


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-29 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-29 17:26 [Bug c++/21287] New: Problems while compiling with some math functions sreevatsan at gmail dot com
2005-04-29 17:52 ` [Bug c++/21287] " pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).