Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

migrating from HPUX11.11 to Itanium V23 - aCC compile issue

Highlighted
Occasional Visitor

migrating from HPUX11.11 to Itanium V23 - aCC compile issue

Hi,

We are migrating a C/C++ application from HPUX11.11 to Itanium V23. I am compiling as a 32 bit application.
I removed the compile explicit include path from the the -I directive as was mentioned in this forum (-I/opt/aCC/include removed) for Itanium compilation.

Now I see an error indicating string is undefined. Adding the /opt/aCC/include results in a different error. Can anyone let me know what is to be done to overcome the same. Thanks in advance for help on this.

"./SiaConstant.h", line 67: error #2020: identifier "string" is undefined
static const string ADDRVCA_NAME;


/opt/aCC/bin/aCC -g0 -v -w +z +Z +Maked +DD32 -I. -I./include -c SiaConsta
nt.cpp -o obj/SiaConstant.o
/opt/aCC/lbin/ecom -architecture 32 -makedepend file -ia64abi all -diag off -in
st compiletime -sysdir /usr/include -test namespaces -koenig_lookup on -inline_p
ower 1 -link_type dynamic -fpeval float -fpevaldec _Decimal32 -tls_dyn on -o obj
/SiaConstant.o -target_os 11.23 -I. -I./include --sys_include /opt/aCC/include_s
td --sys_include /opt/aCC/include_std/iostream_compat --sys_include /usr/include
--sys_include /usr -D_HP_IA64ABI -D_BIND_LIBCALLS -D_Math_errhandling=MATH_ERRE
XCEPT -D__hpux -D__unix -D__ia64=1 -D__ia64__=1 -D_BIG_ENDIAN=1 -D__STDCPP__ -D_
HP_NAMESPACE_STD -D_ILP32 -D__cplusplus=199711L -D_INCLUDE__STDC_A1_SOURCE -D__H
P_aCC=62000 -D_HP_INSTANTIATE_T_IN_LIB -D_INLINE_ASM -D_FLT_EVAL_METHOD=0 -D_DEC
_EVAL_METHOD=0 -debug debugG -ucode hdriver=optlevel%1% -plusolistoption -Ol06al
l! -plusolistoption -Ol13moderate! -plusooption -Oq01,al,ag,cn,sz,ic,vo,Mf,Po,es
,rs,Rf,Pr,sp,in,cl,om,vc,pi,fa,pe,rr,pa,pv,nf,cp,lx,Pg,ug,lu,lb,uj,dn,sg,pt,kt,e
m,np,ar,rp,dl,fs,bp,wp,pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,st,lc,Bl,sr,Qs,do,ib,
pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,dp,If! SiaConstant.cpp

"./SiaConstant.h", line 67: error #2020: identifier "string" is undefined
static const string ADDRVCA_NAME;
4 REPLIES
Occasional Advisor

Re: migrating from HPUX11.11 to Itanium V23 - aCC compile issue

Hi, Pl. help with this guys. I removed the -I /opt/aCC/include from my compile flags, but now the string class shows as undefined. If I include the -I /opt/aCC/include, i get a different error. Thanks, Ranganath
Frequent Advisor

Re: migrating from HPUX11.11 to Itanium V23 - aCC compile issue

Hey Ranganath,

I reproduced your error on my system and I think there are two different ways to solve your problem:

Basically, you don't explicitly specify which C++ standard library you want to use in your compilation. This is quite important as there are two different C++ standard libraries on HP-UX (as reference, see http://docs.hp.com/en/14487/faq.htm) with different functionality and namespaces. By default, the aCC compiler (at least my version A.06.23) uses the "new" C++ standard library by default, enabling the std namespace among others).

a) you keep your compilation options and you either use std::string instead of string _OR_ you use "using namespace std;" at the beginning of the file, e.g.

#include
using namespace std;
static const string ANDI_NAME = "Any String";

b) you keep your source file and just add -AP to the compiler options -> enables the "old" classic C++ standard library without the std namespace

Andi
Acclaimed Contributor [Founder]

Re: migrating from HPUX11.11 to Itanium V23 - aCC compile issue

>Andi: you use "using namespace std;" at the beginning of the file,

Actually you don't want to use that. What you want to use so it works for both -AP and -AA (and other compilers):
namespace std {} using namespace std;
You can put this line before any #include.
Occasional Advisor

Re: migrating from HPUX11.11 to Itanium V23 - aCC compile issue

Hi, Thank you both for this. Used the namespace declaration and it works. I will try with -AP also. Thanks a lot for your help on this.