Operating System - HP-UX
1755261 Members
4910 Online
108831 Solutions
New Discussion

Compiling C++ codes using HP C compiler

 
SOLVED
Go to solution
Aneesh Mohan
Honored Contributor

Compiling C++ codes using HP C compiler

Hi,

 

Can I know whether I can compile C++ codes using HP C compiler /opt/aCC/bin/cc. If so could you let me know the options need to use along with cc.

 

 

OS info:
Release: HP-UX B.11.31
Machine: ia64

 

# swlist -l product |grep -i compiler
ACXX C.06.20 HP C/aC++ Compiler
C-ANSI-C C.06.20 HP C/aC++ Compiler
COMPLIBS B.11.31 Compiler Support Libraries
PHCO_42454 1.0 Linker/Compiler/Unwind ENG Manpage Patch
PHCO_42463 1.0 linker/compiler/unwind Japanese manpage patch
PHSS_38155 1.0 bundled PA C compiler on IPF
PHSS_40631 1.0 HP C/aC++ Compiler (A.06.24)

 

 

Sample Program.

[user12->xxxx]/home/user12/cbs/tmp>more getting_started.cpp
#include <iostream.h>
int main()
{
int x,y;
cout << "Enter an integer: ";
cin >> x;
y = x * 2;
cout << "\n" << y <<" is twice " << x <<".\n";
}


Using cc it is not working

[user12->xxxx]/home/user12/cbs/tmp>cc getting_started.cpp
ld: Mismatched ABI (not an ELF file) for getting_started.cpp
Fatal error.
[user12->xxxx]/home/user12/cbs/tmp>

Using aCC it is working

[user12->xxxx]/home/user12/cbs/tmp>aCC getting_started.cpp
[user12->xxxx]/home/user12/cbs/tmp>echo $?
0
[user12->xxxx]/home/user12/cbs/tmp>ls -l a.out
-rwx------ 1 user12 tuxedo 175608 Jun 25 12:58 a.out
[user12->xxxx]/home/user12/cbs/tmp>

 

Sincere Regards,

Aneesh

3 REPLIES 3
SoumitraC
Frequent Advisor
Solution

Re: Compiling C++ codes using HP C compiler

No, 'cc' is a C compiler.

To compile C++ programs, you must use 'aCC'.

 

Soumitra C
HP-UX Compilers
Aneesh Mohan
Honored Contributor

Re: Compiling C++ codes using HP C compiler

Hi Soumitra,

 

Thank you for your response ,

 

 the below is the comping statement and output  shared to me by developer , regarding "BS-2978.c not found" error message when I checked with him he said that can be ignored . He is claiming that this was working when he last compiled almost a year back in same box :(  

 

compiling option

-----------------

cc +DD64 +Olit=all -Wl,+s -D__BIGMSGQUEUE_ENABLED  -mt  I$TUXDIR/include -o fcreditSrv BS-2978.c  -L${TUXDIR}/lib fcreditSrv.o ccEnqCid.o ccRoutine.o xmlWrapper.cpp DOMTreeErrorReporter.cpp -ltxml /opt/mqm/lib/libmqm_r.so  -ltux -lbuft   -lfml -lfml32 -lengine -lpthread -lcl -lnsl /u01/app/oracle/product/10.2.0.3/lib32/libclntsh.so

 

compiling error messahe

------

cc: error 1913: `BS-d21.c' does not exist or cannot be read

ccEnqCid.c:

cc: error 1913: `BS-d21.c' does not exist or cannot be read

ccRoutine.c:

cc: error 1913: `BS-d21.c' does not exist or cannot be read

fcreditSrv.c:

BS-2978.c:

ld: Mismatched ABI (not an ELF file) for xmlWrapper.cpp

Fatal error.

CMDTUX_CAT:1832: ERROR: can't execute cc +DD32 +Olit=all -Wl,+s -D__BIGMSGQUEUE_ENABLED  -mt  -I$TUXDIR/include -o fcreditSrv BS-2978.c  -L${TUXDIR}/lib fcreditSrv.o ccEnqCid.o ccRoutine.o xmlWrapper.cpp DOMTreeErrorReporter.cpp -ltxml /opt/mqm/lib/libmqm_r.so  -ltux -lbuft   -lfml -lfml32 -lengine -lpthread -lcl -lnsl /u01/app/oracle/product/10.2.0.3/lib32/libclntsh.so

Dennis Handly
Acclaimed Contributor

Re: Compiling C++ codes using HP C compiler

 >He is claiming that this was working when he last compiled almost a year back in same box

 

Not hardly.

The cc driver doesn't know what to do with xmlWrapper.cpp and passes it directly to ld.  ld gives that ABI error.

 

Also, why do you have +DD64 but have libs like:

-lfml32 ... /u01/app/oracle/product/10.2.0.3/lib32/libclntsh.so