Please forgive me if this is blatantly obvious. I’m afraid
I’ve done very little with C++ as yet, but this seems like
something that should work:
Given mathh.cc:
#include <math.h>
int main( int argc, char **argv ) {
return 0;
}
which I attempt to compile as follows:
$ make mathh
g++ mathh.cc -o mathh
In file included from mathh.cc:1:
/usr/include/math.h:558: cos' is already declared in this scope /usr/include/math.h:558:
fabs’ is already declared in this scope
/usr/include/math.h:559: sin' is already declared in this scope /usr/include/math.h:559:
sqrt’ is already declared in this scope
/usr/include/math.h:570: cosf' is already declared in this scope /usr/include/math.h:570:
fabsf’ is already declared in this scope
/usr/include/math.h:571: sinf' is already declared in this scope /usr/include/math.h:571:
sqrtf’ is already declared in this scope
/usr/include/math.h:582: cosl' is already declared in this scope /usr/include/math.h:582:
fabsl’ is already declared in this scope
/usr/include/math.h:583: sinl' is already declared in this scope /usr/include/math.h:583:
sqrtl’ is already declared in this scope
make: *** [mathh] Error 1
$
What’s going wrong? Is math.h broken or is there something I
am supposed to know that I don’t?
-Norton Allen
Francois Desautels wrote:
Try compiling like this: QCC -lm -o mathh mathh.cc, make a make file that
links in the math library.
Thanks, but that wasn’t the problem. LiuG pointed out the problem had
been addressed in another newsgroup and results from a bug in the
specs file. The original posting of the solution is at:
http://groups.google.com/groups?q=specs+colin+group:comp.os.qnx&scoring=r&rnum=1&selm=9j6suf%245kf%241%40nntp.qnx.com
Try compiling like this: QCC -lm -o mathh mathh.cc, make a make file that
links in the math library.
Regards,
Francois
Norton Allen <allen@huarp.harvard.edu> wrote in message
news:3BDDA56F.D6B34879@huarp.harvard.edu…
Please forgive me if this is blatantly obvious. I’m afraid
I’ve done very little with C++ as yet, but this seems like
something that should work:
Given mathh.cc:
#include <math.h
int main( int argc, char **argv ) {
return 0;
}
which I attempt to compile as follows:
$ make mathh
g++ mathh.cc -o mathh
In file included from mathh.cc:1:
/usr/include/math.h:558: cos' is already declared in this scope /usr/include/math.h:558:
fabs’ is already declared in this scope
/usr/include/math.h:559: sin' is already declared in this scope /usr/include/math.h:559:
sqrt’ is already declared in this scope
/usr/include/math.h:570: cosf' is already declared in this scope /usr/include/math.h:570:
fabsf’ is already declared in this scope
/usr/include/math.h:571: sinf' is already declared in this scope /usr/include/math.h:571:
sqrtf’ is already declared in this scope
/usr/include/math.h:582: cosl' is already declared in this scope /usr/include/math.h:582:
fabsl’ is already declared in this scope
/usr/include/math.h:583: sinl' is already declared in this scope /usr/include/math.h:583:
sqrtl’ is already declared in this scope
make: *** [mathh] Error 1
$
What’s going wrong? Is math.h broken or is there something I
am supposed to know that I don’t?
-Norton Allen