Operating System - HP-UX
1832976 Members
2884 Online
110048 Solutions
New Discussion

compilation error on HP-UX

 
girishgawali
Occasional Advisor

compilation error on HP-UX

//tracetest.c
#ifdef VERSANT_ANSI
#include
#include
#include
#include
#include
using namespace std;
using std::ostrstream;
using std::istrstream;
#else
#include
#include
#include
#endif /* VERSANT_ANSI */


void main()
{
............
.....................
const string tooLongMsg(258, 'x');// line no 35
..................................
}

during compilation of this code , I am getting following error

Error (future) 600: "tracetest.c", line 35 # Type specifier is omitted; "int" is no longer assumed.
const string tooLongMsg(258, 'x');
^^^^^
Error 20: "tracetest.c", line 35 # ';' expected before 'tooLongMsg'.
const string tooLongMsg(258, 'x');
^^^^^^^^^^
Error 204: "tracetest.c", line 35 # Uninitialized const variable "const int string".
const string tooLongMsg(258, 'x');

Error 328: "tracetest.c", line 35 # Function 'tooLongMsg' has not been defined yet; cannot call.
const string tooLongMsg(258, 'x');
^^^^^^^^^^
I have included all the required header files need for string type of variable and i am using aCC compiler to compile this program.

I dont know why i am getting this error on
HP-UX only.

can you please help me with this issue

Thanks,
Girish
2 REPLIES 2
Steven Schweda
Honored Contributor

Re: compilation error on HP-UX

> [...] I have included all the required
> header files need for string type of
> variable [...]

Apparently not. Is VERSANT_ANSI defined? If
not, then you'd seem to be getting
, not (and all those other
C++ headers).


> ............
> .....................

A _complete_ test case is easier to test.
Dennis Handly
Acclaimed Contributor

Re: compilation error on HP-UX

>I am using aCC compiler
>I don't know why I am getting this error on HP-UX only.

What is the version of aC++ you are using and what architecure?
If you are on PA, you'll probably need to use -DVERSANT_ANSI and -AA.

>void main()

This is illegal. It must be changed to: int main()