[so] de ce nu merge compilat? aio_read, aio_... errors

George Ciobanu so@atlantis.cs.pub.ro
Tue, 20 Apr 2004 23:54:27 -0700 (PDT)


--0-661659884-1082530467=:48367
Content-Type: text/plain; charset=us-ascii

Salut,
 
 
Problema nu e la compilare ci la link-editare. 
 
gcc aio.c -lrt
 
ar tb sa mearga
 
George

Alex <alexzbant@yahoo.com> wrote:
am un program luat de pe net si nu merge compilat, arata cam asa:
 

#include <aio.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define BYTES 8
int main( int argc, char *argv[] )
{
    int i, r;
    int fildes;
    struct aiocb cb;
    char buff[BYTES];
    
    if ((fildes = open( "/etc/resolv.conf", O_RDONLY )) < 0) {
        perror( "opening file" ); return 1;
    }
    cb.aio_fildes = fildes;
    cb.aio_offset = 0;
    cb.aio_buf = buff;
    cb.aio_nbytes = BYTES;
    cb.aio_reqprio = 0;
    cb.aio_sigevent.sigev_notify = SIGEV_NONE;
    errno = 0;
    r = aio_read( &cb );
    printf( "aio_read() ret: %i\terrno: %i\n", r, errno );
    while (aio_error( &cb ) == EINPROGRESS) { usleep( 10 ); }
    for (i = 0; i < BYTES; i++) { printf( "%c ", buff[i] ); } printf( "\n" );
    errno = 0;
    r = aio_return( &cb );
    printf( "aio_return() ret: %i\tBYTES: %i\terrno: %i\n", r, BYTES, errno );
    return 0;
}
 
e relativ la tema 4 
 
gcc aio.c da erorile : 
 
/tmp/ccLscDQ.o(.text+0x9d): undefined reference to 'aio_read'
/tmp/ccLscDQ.o(.text+0xd2): undefined reference to 'aio_error'
/tmp/ccLscDQ.o(.text+0x148): undefined reference to 'aio_return'
 
As dori sa stiu cum se compileaza. 
Multumesc. 



---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
		
---------------------------------
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
--0-661659884-1082530467=:48367
Content-Type: text/html; charset=us-ascii

<DIV>Salut,</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Problema nu e la compilare ci la link-editare. </DIV>
<DIV>&nbsp;</DIV>
<DIV>gcc aio.c -lrt</DIV>
<DIV>&nbsp;</DIV>
<DIV>ar tb sa mearga</DIV>
<DIV>&nbsp;</DIV>
<DIV>George<BR><BR><B><I>Alex &lt;alexzbant@yahoo.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>am un program luat de pe net si nu merge compilat, arata cam asa:</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>#include &lt;aio.h&gt;<BR>#include &lt;errno.h&gt;<BR>#include &lt;stdio.h&gt;<BR>#include &lt;string.h&gt;<BR>#include &lt;unistd.h&gt;</DIV>
<DIV>#define BYTES 8</DIV>
<DIV>int main( int argc, char *argv[] )<BR>{<BR>&nbsp;&nbsp;&nbsp; int i, r;<BR>&nbsp;&nbsp;&nbsp; int fildes;<BR>&nbsp;&nbsp;&nbsp; struct aiocb cb;<BR>&nbsp;&nbsp;&nbsp; char buff[BYTES];<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; if ((fildes = open( "/etc/resolv.conf", O_RDONLY )) &lt; 0) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perror( "opening file" ); return 1;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; cb.aio_fildes = fildes;<BR>&nbsp;&nbsp;&nbsp; cb.aio_offset = 0;<BR>&nbsp;&nbsp;&nbsp; cb.aio_buf = buff;<BR>&nbsp;&nbsp;&nbsp; cb.aio_nbytes = BYTES;<BR>&nbsp;&nbsp;&nbsp; cb.aio_reqprio = 0;<BR>&nbsp;&nbsp;&nbsp; cb.aio_sigevent.sigev_notify = SIGEV_NONE;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; errno = 0;<BR>&nbsp;&nbsp;&nbsp; r = aio_read( &amp;cb );<BR>&nbsp;&nbsp;&nbsp; printf( "aio_read() ret: %i\terrno: %i\n", r, errno );</DIV>
<DIV>&nbsp;&nbsp;&nbsp; while (aio_error( &amp;cb ) == EINPROGRESS) { usleep( 10 ); }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; for (i = 0; i &lt; BYTES; i++) { printf( "%c ", buff[i] ); } printf( "\n" );</DIV>
<DIV>&nbsp;&nbsp;&nbsp; errno = 0;<BR>&nbsp;&nbsp;&nbsp; r = aio_return( &amp;cb );<BR>&nbsp;&nbsp;&nbsp; printf( "aio_return() ret: %i\tBYTES: %i\terrno: %i\n", r, BYTES, errno );</DIV>
<DIV>&nbsp;&nbsp;&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>e relativ la tema 4 </DIV>
<DIV>&nbsp;</DIV>
<DIV>gcc aio.c da erorile : </DIV>
<DIV>&nbsp;</DIV>
<DIV>/tmp/ccLscDQ.o(.text+0x9d): undefined reference to 'aio_read'</DIV>
<DIV>/tmp/ccLscDQ.o(.text+0xd2): undefined reference to 'aio_error'</DIV>
<DIV>/tmp/ccLscDQ.o(.text+0x148): undefined reference to 'aio_return'</DIV>
<DIV>&nbsp;</DIV>
<DIV>As dori sa stiu cum se compileaza. </DIV>
<DIV>Multumesc. <BR></DIV>
<P>
<HR SIZE=1>
<FONT face=arial size=-1>Do you Yahoo!?<BR>Yahoo! Photos: <A href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=23765/*http://photos.yahoo.com/ph/print_splash">High-quality 4x6 digital prints for 25¢</A></BLOCKQUOTE></FONT><p>
		<hr size=1><font face=arial size=-1>Do you Yahoo!?<br>
Yahoo! Photos: <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=23765/*http://photos.yahoo.c
om/ph/print_splash">High-quality 4x6 digital prints for 25¢</a>
--0-661659884-1082530467=:48367--