f



Re: [ace-users] Compile time error: "error: 'write_n' is not a member of 'ACE'"

Hi,

You lack an include, include "ace/ACE.h" in your program

Regards,

Johnny Willemsen
Remedy IT
Postbus 101
2650 AC  Berkel en Rodenrijs
The Netherlands
www.theaceorb.nl / www.remedy.nl  


"Paresh" <pareshspednekar@gmail.com> wrote in message
news:<1173985162.346951.209100@y66g2000hsf.googlegroups.com>...
> Hi All,
> 
> ACE VERSION: 5.5.6
> HOST MACHINE and OPERATING SYSTEM: LINUX, Kernel 2.6.19-1.2288.fc5,
> i686
> 
> I tried to compile the program given below, but was giving following
> compilation error:
> Please help me to compile this proram
> 
> ---------------------------------------
> COMPILATION------------------------------------------
> [root@paresh ACE_MSG_BLOCK]# g++ main.C -o main -lACE -IACE_ROOT
> main.C: In function 'int main(int, char**)':
> main.C:9: error: 'read_n' is not a member of 'ACE'
> main.C:20: error: 'write_n' is not a member of 'ACE'
> ----------------------------------END
> COMPILATION--------------------------------------------
> 
> 
> 
> ---------------------------------------------PROGRAM
> main.C---------------------------------------------
> 
> #include "ace/OS.h"
> #include "ace/Message_Block.h"
> 
> int main(int argc, char* argv[]) {
>         ACE_Message_Block *head = new  ACE_Message_Block(BUFSIZ);
>         ACE_Message_Block *mblk = head;
> 
>         for(;;) {
>                 ssize_t nbytes = ACE::read_n(ACE_STDIN, mblk-
> >wr_ptr(), mblk->size());
>                 if(nbytes <= 0)
>                         break;
> 
>                 mblk->wr_ptr(nbytes);
> 
>                 mblk->cont(new ACE_Message_Block(BUFSIZ));
>                 mblk = mblk->cont();
>         }
> 
>         for(mblk = head; mblk != 0/*NULL POINTER*/; mblk = mblk-
> >cont()) {
>                 ACE::write_n(ACE_STDOUT, mblk->rd_ptr(), mblk-
> >length());
>         }
> 
>         head->release();
>         return 0;
> }
> 
> ------------------------------- END
> -------------------------------------
> 

0
Johnny
3/15/2007 7:16:46 PM
comp.soft-sys.ace 20326 articles. 1 followers. marlow.andrew (167) is leader. Post Follow

1 Replies
1091 Views

Similar Articles

[PageSpeed] 57

Thanks Johnny,

I could compile the program after including ACE header.

Where can i get the man pages for all the ACE functions?
Currently the read_n() function does not return untill i enter ^c or
^d  .

Thanks,
Paresh


On Mar 16, 12:16 am, "Johnny Willemsen" <jwillem...@remedy.nl> wrote:
> Hi,
>
> You lack an include, include "ace/ACE.h" in your program
>
> Regards,
>
> Johnny Willemsen
> Remedy IT
> Postbus 101
> 2650 AC  Berkel en Rodenrijs
> The Netherlandswww.theaceorb.nl/www.remedy.nl
>
> "Paresh" <pareshspedne...@gmail.com> wrote in message
>
> <news:1173985162.346951.209100@y66g2000hsf.googlegroups.com>...
>
> > Hi All,
>
> > ACE VERSION: 5.5.6
> > HOST MACHINE and OPERATING SYSTEM: LINUX, Kernel 2.6.19-1.2288.fc5,
> > i686
>
> > I tried to compile the program given below, but was giving following
> > compilation error:
> > Please help me to compile this proram
>
> > ---------------------------------------
> > COMPILATION------------------------------------------
> > [root@paresh ACE_MSG_BLOCK]# g++ main.C -o main -lACE -IACE_ROOT
> > main.C: In function 'int main(int, char**)':
> > main.C:9: error: 'read_n' is not a member of 'ACE'
> > main.C:20: error: 'write_n' is not a member of 'ACE'
> > ----------------------------------END
> > COMPILATION--------------------------------------------
>
> > ---------------------------------------------PROGRAM
> > main.C---------------------------------------------
>
> > #include "ace/OS.h"
> > #include "ace/Message_Block.h"
>
> > int main(int argc, char* argv[]) {
> >         ACE_Message_Block *head = new  ACE_Message_Block(BUFSIZ);
> >         ACE_Message_Block *mblk = head;
>
> >         for(;;) {
> >                 ssize_t nbytes = ACE::read_n(ACE_STDIN, mblk-
> > >wr_ptr(), mblk->size());
> >                 if(nbytes <= 0)
> >                         break;
>
> >                 mblk->wr_ptr(nbytes);
>
> >                 mblk->cont(new ACE_Message_Block(BUFSIZ));
> >                 mblk = mblk->cont();
> >         }
>
> >         for(mblk = head; mblk != 0/*NULL POINTER*/; mblk = mblk-
> > >cont()) {
> >                 ACE::write_n(ACE_STDOUT, mblk->rd_ptr(), mblk-
> > >length());
> >         }
>
> >         head->release();
> >         return 0;
> > }
>
> > ------------------------------- END
> > -------------------------------------


0
Paresh
3/15/2007 7:50:06 PM
Reply: