This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: std::cout
- From: de Chalendar Gael <de-chalendarg at zoe dot cea dot fr>
- To: eduardoo at antar dot com dot mx
- Cc: gcc-help at gcc dot gnu dot org
- Date: 04 Dec 2002 17:56:56 +0000
- Subject: Re: std::cout
- References: <20021204164815.90337.qmail@web11507.mail.yahoo.com>
The library to use is <cmath> which is the standard replacement of
<math.h>.
The same is true for other C libraries : <cstdio> for <stdio.h>, etc.
Gael
On mer, 2002-12-04 at 16:48, Eduardo Osorio Armenta wrote:
> okey !
>
> i tried to compile this program
> with
>
> g++ exponencial.cpp -o exponencial -g -O2 -Wall -lm
>
> ---------------------------------------------------
> #include <iostream>
> #include <sstream>
> #include <math>
> #include <string>
>
> using namespace std;
>
> int
> main (int argc, char **argv)
> {
> int i;
> string szTexto ("hola con string en g++");
>
> cout << szTexto << endl;
>
> for (i = 0; i < 32; i++)
> {
> cout << "2^" << dec << i << " = 0x" << hex <<
> (int) pow (2, i) << endl;
> }
> return 0;
> }
> ----------------------------------------------------
> but the answer
>
> $ make exponencial
> g++ exponencial.cpp -o exponencial -g -O2 -Wall
> exponencial.cpp:4:16: math: No such file or directory
> exponencial.cpp: In function `int main(int, char**)':
> exponencial.cpp:19: call of overloaded `pow(int,
> int&)' is ambiguous
> /usr/include/math.h:60: candidates are: double
> pow(double, double)
> /usr/include/c++/3.2/cmath:427: long
> double std::pow(long
> double, int)
> /usr/include/c++/3.2/cmath:423: float
> std::pow(float, int)
> /usr/include/c++/3.2/cmath:419: double
> std::pow(double, int)
> /usr/include/c++/3.2/cmath:414: long
> double std::pow(long
> double, long double)
> /usr/include/c++/3.2/cmath:401: float
> std::pow(float, float)
> make: *** [exponencial] Error 1
>
>
> what it's wrong with <math> or maybe <math.h>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com