Operating System - HP-UX
1825771 Members
2398 Online
109687 Solutions
New Discussion

Re: aCC Error: Referenced object 'attach' is not a member of class basic_ofstream

 
Tuan A. Le
Occasional Contributor

aCC Error: Referenced object 'attach' is not a member of class basic_ofstream


Hello,

I'm migrating an application (omniORB) from hp-ux pa-risc to hp-ux Itanium (11.20) and getting an fstream definition error.

Below are the error and code section:


aCC -c -O -w -AA -mt -I /opt/aCC/include_std +DD64 +DSnative -I.
-D__OMNIORB2__ -I../../../stub -DRWSTD_MULTI_THREAD -DRW_MULTI_THREAD
-D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -DDEFAULT_LOGDIR='"/var/omninames"' -
I. -I../../../include -D__ia64__ -D__hpux__ -D__OSVERSION__=11 -ldir log.cc -o log.o
Error 187: "log.cc", line 356 # Referenced object 'attach' is not a member of
class basic_ofstream > ["/opt/aCC/include_std/fstream", line 368].
logf.attach(fd);
^^^^^^
===========

#if defined(USE_ATTACH_FD)
# ifdef __WIN32__
int fd = _open(active, O_WRONLY | O_APPEND);
# else
int fd = open(active, O_WRONLY | O_APPEND | O_SYNC);
# endif

if (fd < 0) {
cerr << ts.t() << "Error: cannot open log file '" << active
<< "' for writing." << endl;
exit(1);
}
logf.attach(fd);
#else
logf.open(active,ios::out|ios::app,0666);
if (!logf) {
cerr << ts.t() << "Error: cannot open log file '" << active
<< "' for writing." << endl;
exit(1);
}
#endif

==================

It appears that attach is defined in fstream.h but not in the std implementation.

Any suggestions on how to resolve this error are appreciated. What's the equivalent ANSI C++ Standard implementation? I'm new to C++ and hp-ux.

Thanks,

TL

2 REPLIES 2
Kevin Huang_3
New Member

Re: aCC Error: Referenced object 'attach' is not a member of class basic_ofstream

Hi, TL,

Did you resovle it?
If not, try to add the line
using namespace std;
after
#include

Goo luck.

-Kevin
Kevin Huang_3
New Member

Re: aCC Error: Referenced object 'attach' is not a member of class basic_ofstream

Hi, TL,

Did you resovle it?
If not, try to add the line
using namespace std;
after
#include

Good luck.

-Kevin