1825576 Members
2109 Online
109682 Solutions
New Discussion

aCC Compile Error 585

 
Guido  Rost
New Member

aCC Compile Error 585

After I compiled my code on several Unix and Windows platforms I got this strange Error on HP-UX and I can't figure out the problem. The problem is this:
Error 585: ./h/typemgr_intern.h, line 139 # Expected an operator before '::'.
const o_double MAX = (std::numeric_limits::max)();
^^
Error 172: ./h/typemgr_intern.h, line 139 # Undeclared variable 'std'.
const o_double MAX = (std::numeric_limits::max)();

The compiler call looks like this:
aCC -I. -I./h -I../h -I../om/h -I../sm/h -O -c +Z +DA2.0W +DS2.0 -DHP11 -mt -DVS_USE_64_CALLS -D_LARGEFILE64_SOURCE -o /build/qa/VOD/VOD_7.x_Integration/VOD7.0.1.4-144-20080520_2030/HP-UX_64bit/opt/build_area/kernel/7.0.1.4/HP-UX_64bit/opt//o/typemgr.o /versant/vod/qa.local/VOD_7.x_Integration/VOD7.0.1.4-144-20080520_2030/src/kernel/typemgr/typemgr.c

Would be great if someone can help me.
Thanks,
Guido
19 REPLIES 19
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>After I compiled my code on several Unix and Windows platforms

If you want to use the std namespace, you'll need to compile with -AA. Be aware the default on PA is -AP and if your application is going to use third party C++ libs, you may have to port back to -AP mode:
http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801/?ciid=eb08b3f1eee02110b3f1eee02110275d6e10RCRD

>Error 172: # Undeclared variable 'std'.

namespace std isn't defined.

>aCC -O -c +Z +DA2.0W +DS2.0 -mt -D_LARGEFILE64_SOURCE

You should replace obsolete +DA2.0W by +DD64.
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>const o_double MAX = (std::numeric_limits::max)();

What do you think this syntax should be doing?
Did you want to do:
const o_double MAX = numeric_limits::max();

Guido  Rost
New Member

Re: aCC Compile Error 585

Thanks for you reply. Your suggestion worked. The incorrect line was the output of the compiler. The source code looks of course different.
Thanks,
Guido
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

If you are happy with the answers you got, please read the following about how to assign points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
Neel2
Regular Advisor

Re: aCC Compile Error 585

Hello,

Could you please let me know, how can i compile the following statement on PA-RISC
using the following conf:
aCC: HP ANSI C++ B3910B A.03.57
HP-UX B.11.11 U 9000/800 109092009 unlimited-user license

The statement is:
const o_double MAX = (std::numeric_limits::max)();


Currently I can compile the above statement using -AA, but i need to compile with the default on PA-RISC which is -AP, Could you please let me know how can modify the above statement in order to get compile with -AP.

I have gone thru the following FAQ's.
Can I use this in any way:
11. Can I write code that works for both?

Yes. Only with conditional compilation. And/or by using the following
namespace std:: construct:
namespace std {} using namespace std;
You can put this construct anywhere, as many times as you like. Or once at the beginning - as long it is before you reference any symbol that doesn't have the needed std::. And you can use it with -AP too.


Regards,
Neel
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>how can I compile the following statement on PA-RISC:
>const o_double MAX = (std::numeric_limits::max)();

Why do you have an extra set of () around the function name? Remove it.

>but I need to compile with the default on PA-RISC which is -AP, Could you please let me know how can modify the above statement in order to get compile with -AP.

The simple way is to use:
const o_double MAX = numeric_limits::max();
You can also use:
const o_double MAX = ::numeric_limits::max();

That way you can evil macros and have std be replaced by empty:
#define std

>Can I use this in any way:
>namespace std {} using namespace std;

This works if you leave out "std::" in front of everything. Then you use the namespace directive to also look in namespace std in -AA mode, in the global namespace for -AP.
Neel2
Regular Advisor

Re: aCC Compile Error 585

aCC -I. -I./h -I../h -I../om/h -I../sm/h -O -c +DD64 +Z -DHP11 -mt -DVS_USE_64_CALLS -D_LARGEFILE64_SOURCE -o /dsk1/nkhemkar/vod7014_build_64bit/kernel/7.0.1.4/HP-UX_64bit/opt//o/typemgr.o /dsk1/skadam/src/kernel/typemgr/typemgr.c
Error 172: "./h/typemgr_intern.h", line 140 # Undeclared variable 'std'.
const o_double MAX = std::numeric_limits::max();
^^^
Error 20: "./h/typemgr_intern.h", line 140 # ';' expected before '::'.
const o_double MAX = std::numeric_limits::max();
^^
aCC throws the above error.

Regards,
Neel
Neel2
Regular Advisor

Re: aCC Compile Error 585

The following works, without -AA:

const o_double MAX =
::numeric_limits::max();

Thanks,
Neel
Neel2
Regular Advisor

Re: aCC Compile Error 585

So, its using the default namespace or std namespace, could you please explain a bit.

Neel2
Regular Advisor

Re: aCC Compile Error 585

Hello,

Also, Could you please let me know, the diagnostic for the following warnings.

I have gone thru at: http://docs.hp.com/en/11925/Diagnostics_Documentation/Diagnostics_index.htm#2068

But could not find anything related to the same.

------------------------------------------------
Warning 829: "/dsk1/src/kernel/ut/chk/chkusage.c", line 940 # Implicit conversion of string literal to 'char *' is deprecated.
a_printf("\npart of the \"-sys\" module in case the module is not"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 829: "/dsk1/src/kernel/ut/chk/chkusage.c", line 942 # Implicit conversion of string literal to 'char *' is deprecated.
a_printf("\ne.g \"%s -check \" is the same as \"%s -sys -check"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 829: "/dsk1/src/kernel/ut/chk/chkusage.c", line 944 # Implicit conversion of string literal to 'char *' is deprecated.
a_printf("\n\n");
^^^^^^
Warning 749: "/dsk1/src/kernel/sl/slheap.c", line 2322 # The cast from 'h
eap_header *' to 'heap_shared *' is performed as a 'reinterpret_cast'. This oper
ation is non-portable and potentially unsafe.
err = sl_shared_extend(HEAP_SHARED(heap_header), desired_size,
^^^^^^^^^^^
Warning 749: "/dsk1/src/kernel/sl/slheap.c", line 2339 # The cast from 'h
eap_header *' to 'heap_local *' is performed as a 'reinterpret_cast'. This opera
tion is non-portable and potentially unsafe.
local = HEAP_LOCAL(heap_header);
^^^^^^^^^^


Thanks in advance.

Regards,
Neel
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>it's using the default namespace or std namespace, could you please explain a bit.

-AP uses the global namespace for the STL.
-AA uses namespace std.

>the diagnostic for the following warnings.

Which, the aCC6 ones for the aCC3 ones?

To get Warning 829, you may have to use +w but then you'll be sorry. :-)

Warning 749, there is none.
These two are the must likely warnings to be suppressed in aCC3.

Or did you want to fix them in aCC3??
Neel2
Regular Advisor

Re: aCC Compile Error 585

I am getting the above warning in aCC: HP ANSI C++ B3910B A.03.57.

Also, any suggestions to generalize or (remove the dependency) of the following code,i.e.

const o_double MAX = ::numeric_limits::max();

Since, its got failed on other platform with the following error:

g++ -I. -I./h -I../h -I../om/h -I../sm/h -O -c -D_REENTRANT -DVS_USE_64_CALLS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fpic -Wall -o /dsk1/VOD_BUILD/kernel/7.0.1.4/Linux_64bit_rhe4.0/opt//o/typemgr.o /vobs/kernel/typemgr/typemgr.c
In file included from /vobs/kernel/typemgr/typemgr.c:16:
./h/typemgr_intern.h: In function `o_err tm_isValid(o_typeid, T)':
./h/typemgr_intern.h:139: error: `numeric_limits' undeclared (first use this function)
./h/typemgr_intern.h:139: error: (Each undeclared identifier is reported only once for each function it appears in.)
./h/typemgr_intern.h:139: error: expected primary-expression before '>' token
./h/typemgr_intern.h:139: error: `::max' has not been declared

Thanks in advance.

Neel
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>I am getting the above warning in aCC A.03.57.

You can squash them like a bug with +W829,749.

Note that 829 is going to be errors in the next Standard so you should fix them all. You need to declare a_printf as taking a const char*.
For 749, you can add the reinterpret_cast. Note the types in the message must not be derived classes from each other.

>any suggestions to generalize or (remove the dependency) of the following code
const o_double MAX = ::numeric_limits::max();

You are going to have to use conditional compilation:
#if !defined(_HP_NAMESPACE_STD) && defined(__HP_aCC)
#define STD_NS
#else
#defined STD_NS std
#endif
const o_double MAX = STD_NS::numeric_limits::max();
Neel2
Regular Advisor

Re: aCC Compile Error 585

Hello Dennis,

I tried the following:

#if defined(__hpux)
#if !defined(_HP_NAMESPACE_STD)&&defined(__HP_aCC)
#defined STD_NS
#defined STD_NS std
#endif
const o_double MAX = STD_NS::numeric_limits::max();
#else /* defined(__hpux)*/
const o_double MAX = (std::numeric_limits::max)();
#endif /* __hpux */


The compilation throws an error for STD_NS not defined ;-(

Could you suggest me the right way?

Neel
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>Could you suggest me the right way?

You lost the #else and added a whole extra level of #if. Use what I gave you, it should work for aC++ or any other compiler.
Neel2
Regular Advisor

Re: aCC Compile Error 585

Hello Dennis,

Thanks it works as it is.

Best regards,
Neel
Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>Thanks it works as it is.

If you have gotten the answers you wanted, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
Neel2
Regular Advisor

Re: aCC Compile Error 585

Hello,

I got the following error:

/usr/lib/dld.sl: Unresolved symbol: __shlinit (code) from /build/HP-UX_32bit/opt/lib/libembed.sl

My conf:
% uname -a
HP-UX B.11.11 U 9000/800 109092009 unlimited-user license
% aCC -V
aCC: HP ANSI C++ B3910B A.03.57

Any pointers/suggestion will be helpful.

Thanks,
Neel

Dennis Handly
Acclaimed Contributor

Re: aCC Compile Error 585

>I got the following error:
>dld.sl: Unresolved symbol: __shlinit (code)

You need to create your own thread so you can assign points. Especially for this different topic.