Hello, On 10-5-23 下午9:46, Marc Glisse wrote: > On Sun, 23 May 2010, Da Zheng wrote: > >> da-zhengs-macbook:tmp dazheng$ gcc -o test test.c >> Undefined symbols: >> "___sync_val_compare_and_swap_4", referenced from: >> _main in ccyxRK5Y.o >> ld: symbol(s) not found >> collect2: ld returned 1 exit status >> >> I use macbook and it has Intel Dual core. My GCC version is 4.4.1. >> Could anyone >> tell me why __sync_val_compare_and_swap cannot be used. Thank you. > > You probably need an appropriate -march flag (386, which the compiler > may target by default, doesn't have the instructions). Thanks. It works. I thought GCC could choose a right architecture automatically. Zheng Da