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

Alex so@atlantis.cs.pub.ro
Tue, 20 Apr 2004 22:19:25 -0700 (PDT)


--0-193949939-1082524765=:57135
Content-Type: text/plain; charset=us-ascii

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¢
--0-193949939-1082524765=:57135
Content-Type: text/html; charset=us-ascii

<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.c
om/ph/print_splash">High-quality 4x6 digital prints for 25¢</a>
--0-193949939-1082524765=:57135--