1752615 Members
4277 Online
108788 Solutions
New Discussion юеВ

Re: C++ on HP-UX 11.23

 
SOLVED
Go to solution
Igor Sovin
Super Advisor

C++ on HP-UX 11.23

Hi!
What software environment do I need to compile and run C++ (object orinted) programs under HP-UX 11.23?

For example, now I use cc compiler and I get such errors:

Simple program text:
root@lev /home/igorps>more cout.c
#include
void main(){
cout << "Hello, World!\n";
}

root@lev /home/igorps>cc cout.c
Error 112: "cout.c", line 1 # Include file not found.
#include
^^^^^^^^^^^^
Error (future) 355: "cout.c", line 2 # Function 'main' must return type 'int'.
void main(){
^^^^
Error 172: "cout.c", line 3 # Undeclared variable 'cout'.
cout << "Hello, World!\n";
^^^^
Warning: 1 future errors were detected and ignored. Add a '+p' option to detect and fix them before they become fatal errors in a future release. Behavior of this ill-formed program is not guaranteed to match that of a well-formed program
7 REPLIES 7
Arunvijai_4
Honored Contributor

Re: C++ on HP-UX 11.23

Hi Igor,

You need to have either aCC or GCC to compile C++ programs in HP-UX 11.23. You can download them from these locations,

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B9007AAEVAL

http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,7663,00.html

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Igor Sovin
Super Advisor

Re: C++ on HP-UX 11.23

I've tried to use gcc, but I get other errors.
GCC compiler couldn't find .h files

root@lev /home/igorps>/usr/local/bin/gcc cout.c
cout.c:1:22: iostream.h: No such file or directory
cout.c: In function `main':
cout.c:3: error: `cout' undeclared (first use in this function)
cout.c:3: error: (Each undeclared identifier is reported only once
cout.c:3: error: for each function it appears in.)
cout.c:2: warning: return type of 'main' is not `int'
Dima_Ru
Occasional Contributor
Solution

Re: C++ on HP-UX 11.23

You can take gcc package from
http://hpux.cs.utah.edu/
or
http://mirrors.develooper.com/hpux/downloads.html.

If gcc can't find iostream.h that means that it is installed incorrectly. The best way is to compile sources from www.gnu.org and then install them.

Dennis Handly
Acclaimed Contributor

Re: C++ on HP-UX 11.23

You are trying to use an obsolete or bundled C compiler on IPF to compile C++ source.

>gcc compiler couldn't find .h files

The Standard name is <iostream> and not <iostream.h>. For aCC, you need -AA to compile with the Standard. -AP (the default on PA) only takes the <iostream.h> name.

Steve Ellcey
Valued Contributor

Re: C++ on HP-UX 11.23

With respect to the GNU compilers, gcc is a C compiler, you should use g++ to compile and link C++ code, not gcc.
Igor Sovin
Super Advisor

Re: C++ on HP-UX 11.23

Hi Steve!

Where can I download g++ ?
Dennis Handly
Acclaimed Contributor

Re: C++ on HP-UX 11.23

You can download a trial version of the C/aC++ compilers from:
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,7863,00.html