Re: Problem compiling with -AA option, aCC A.03.56 (173 Views)
Reply
Occasional Contributor
Posts: 5
Registered: ‎10-21-2004
Message 1 of 2 (173 Views)

Problem compiling with -AA option, aCC A.03.56

Somehow we have problems compiling even the simplest programs with -AA option. For example, I am trying to compile the file:

<--------- cmath_test.cpp ---------
#include
int main(int argc, char *argv[])
{
return 0;
}
--------- cmath_test.cpp --------->

$ /opt/aCC.356/bin/aCC -AA cmath_test.cpp
Error 328: "/opt/aCC.356/include_std/cmath", line 43 # Function 'fabs' has not been defined yet; cannot call.
inline double abs(double d) { return fabs(d); }
^^^^
...


Well, I used -E and -P options to find out why the errors happen. I found that all the functions in the math.h header ended up declared in std::std (double std) namespace. Then I looked at the cmath and math.h files.

<--------- cmath, lines 17 thru 27 ---------
#if !defined(RWSTD_NO_NAMESPACE) && !defined(_NAMESPACE_STD)

#include // indirectly picks up for
#include
#include

#define _NAMESPACE_STD
namespace std {
#include
} // namespace std
#undef _NAMESPACE_STD
--------- cmath, lines 17 thru 27 --------->

<--------- math.h, lines 32 thru 36 ---------
#ifdef _NAMESPACE_STD
namespace std {
#endif
extern double acos(double);
extern double asin(double);
--------- math.h, lines 32 thru 36 --------->

cmath opens namespace std the first time, defines the macro _NAMESPACE_STD, includes math.h, then math.h opens namespace std the second time when the macro _NAMESPACE_STD is defined.

We use the aCC A.03.56 compiler, HP-UX B.11.11 U 9000/800.

$ cksum /opt/aCC.356/include_std/cmath
2144126240 4822 /opt/aCC.356/include_std/cmath
$ cksum /usr/include/math.h
2126400671 22688 /usr/include/math.h

Please help. I will provide more information if necessary.

Thanks,
Anatoly.
Honored Contributor
Posts: 1,155
Registered: ‎11-24-2004
Message 2 of 2 (173 Views)

Re: Problem compiling with -AA option, aCC A.03.56

What happens if you try and compile

#include
using namespace std;
int main(int argc, char *argv[])
{
return 0;
}
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.