Operating System - HP-UX
1820879 Members
3608 Online
109628 Solutions
New Discussion юеВ

Compilation fails with "identifier "bad_alloc" is undefined"

 
K!rn Kumr
Frequent Advisor

Compilation fails with "identifier "bad_alloc" is undefined"

I am trying to compile my code on Itanium. And I get the following error.

cpp: "/opt/aCC/include_std/iostream_compat/iostream.h", line 4: error 4052: Unknown preprocessing directive.
cpp: "/opt/aCC/include_std/iostream_compat/fstream.h", line 4: error 4052: Unknown preprocessing directive.

I have included the paths /opt/aCC/include and /opt/aCC/include/iostream during compilation and that solved my previous problems.

But now I have 3 new problems

"/opt/aCC/include/memory", line 493: error #2020: identifier "bad_alloc" is undefined
RWSTD_THROW_NO_MSG(tmp == 0, bad_alloc);

"/opt/aCC/include/stdexcept", line 73: error #2262: not a class or struct name
class RWSTDExport logic_error : public exception

"/opt/aCC/include/stdexcept", line 149: error #2262: not a class or struct name
class RWSTDExport runtime_error : public exception

When I have gone through the library files I could find all the very well defined in the path that I have included but it is not able to pick it up. I was wondering y.

Can anyone please help me on fixing this pls

10 REPLIES 10
K!rn Kumr
Frequent Advisor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

can anyone please suggest me something on this....
Dennis Handly
Acclaimed Contributor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

(Please don't put your questions in an old thread and a new old. Pick one place.)

>cpp: "/opt/aCC/include_std/iostream_compat/iostream.h", line 4: error 4052: Unknown preprocessing directive.

Your preprocessor (cpp.ansi?) is broken. You'll need to enhance it to handle #warning.
I've already filed an enhancement QXCR1000529558 for this.

>I have included the paths /opt/aCC/include and /opt/aCC/include/iostream

As mentioned in your other thread, do NOT do this!
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1300257

If you can't change your preprocessor, you'll need to remove all cfront (-AP) iostream includes and replace by the Standard ones, , .
K!rn Kumr
Frequent Advisor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

what do you mean when u say its broken. I use aCC compiler. But without including the path it is not able to pick up the default libraries even. Would there be any work around for this.
Dennis Handly
Acclaimed Contributor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

>what do you mean when you say it's broken?

cpp.ansi doesn't know about #warning, so +legacy_cpp can't be used.

>I use aCC compiler.

Why are you using cpp.ansi or +legacy_cpp?

>But without including the path it is not able to pick up the default libraries even.

You will have to provide some proof of this. Do you have an error and the -v output?

K!rn Kumr
Frequent Advisor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

These are the compile flags that I use to compile my files

+Aa +p +O2 +Ofltacc=relaxed +Onolimit +DSmontecito +FPD -Wl,+pi,1M -Wl,+pd,1M -Wl,+mergeseg +DD64 +M2 -Wl,+s +w1

I know nothing about cpp.ansi or +legacy_.

But what I am doing is porting the code that was being run on very much older version of hpux to itanium2 now.
Dennis Handly
Acclaimed Contributor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

>These are the compile flags that I use to compile my files

Are you sure you aren't using some type of SQL preprocessor?

>But what I am doing is porting the code that was being run on very much older version of HP-UX to Integrity

You are doing a port from -AP to -AA. Those #warning are trying to tell you to change your source, if you want to be Standard.
K!rn Kumr
Frequent Advisor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

Yeah I am porting some proc files as well. I am not sure of those files.

So how do I make them standard.
Dennis Handly
Acclaimed Contributor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

>I am porting some proc files as well. I am not sure of those files.

Then your SQL preprocessor is broken and you need to get it fixed.

>So how do I make them standard?

If you look at the lines in question it tells you:
#warning is being replaced by followed by "using namespace std;"
#include
using namespace std;
K!rn Kumr
Frequent Advisor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

Can you please let me know the solution for that. What exactly do i need to do for fixin the problem.
Dennis Handly
Acclaimed Contributor

Re: Compilation fails with "identifier "bad_alloc" is undefined"

>solution for that.

That what? Two things were discussed in my last reply. I mentioned the solution to the -AA porting. I have no clue how your broken preprocessing step works so all I can do is hand wave.