undefined builtin atomic operations in gcc4.2

Juan Carlos Franzoy jfranzoy@yahoo.com.ar
Fri Feb 1 19:52:00 GMT 2008


Hello. I am having problems traying to call __sync_fetch_and_add(int,int). Does anybody know what I'm missing?


the program is a.c:
------------------------ a.c ----------------------------
int i = 0;
int main() {
    int b =  __sync_fetch_and_add( &i, 1 );
    return b;
}
----------------------- end of a.c ----------------------


The error is:
-----------------------------------------------------------------
$ /usr/local/gcc-4.2.2/bin/gcc -oa a.c
/tmp/ccaiRBpH.o(.text+0x21): In function `main':
: undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status


gcc -v shows:
-----------------------------------------------------------------

$ /usr/local/gcc-4.2.2/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.2/configure --prefix=/usr/local/gcc-4.2.2 --enable-__cxa_atexit --with-system-zlib --enable-threads=posix --enable-languages=c,c++
Thread model: posix
gcc version 4.2.2


uname -a shows:
-----------------------------------------------------------------

$ uname -a
Linux aquila 2.4.21-4.EL #1 Fri Oct 3 18:13:58 EDT 2003 i686 i686 i386 GNU/Linux



Thanks.




      Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar



More information about the Gcc-help mailing list