[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> </DIV>
<DIV><BR>#include <aio.h><BR>#include <errno.h><BR>#include <stdio.h><BR>#include <string.h><BR>#include <unistd.h></DIV>
<DIV>#define BYTES 8</DIV>
<DIV>int main( int argc, char *argv[] )<BR>{<BR> int i, r;<BR> int fildes;<BR> struct aiocb cb;<BR> char buff[BYTES];<BR> <BR> if ((fildes = open( "/etc/resolv.conf", O_RDONLY )) < 0) {<BR> perror( "opening file" ); return 1;<BR> }</DIV>
<DIV> cb.aio_fildes = fildes;<BR> cb.aio_offset = 0;<BR> cb.aio_buf = buff;<BR> cb.aio_nbytes = BYTES;<BR> cb.aio_reqprio = 0;<BR> cb.aio_sigevent.sigev_notify = SIGEV_NONE;</DIV>
<DIV> errno = 0;<BR> r = aio_read( &cb );<BR> printf( "aio_read() ret: %i\terrno: %i\n", r, errno );</DIV>
<DIV> while (aio_error( &cb ) == EINPROGRESS) { usleep( 10 ); }</DIV>
<DIV> for (i = 0; i < BYTES; i++) { printf( "%c ", buff[i] ); } printf( "\n" );</DIV>
<DIV> errno = 0;<BR> r = aio_return( &cb );<BR> printf( "aio_return() ret: %i\tBYTES: %i\terrno: %i\n", r, BYTES, errno );</DIV>
<DIV> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV>e relativ la tema 4 </DIV>
<DIV> </DIV>
<DIV>gcc aio.c da erorile : </DIV>
<DIV> </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> </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--