the errors coming are:
#gcc -o test test.o /usr/lib/ast/mod/quad.so
/usr/lib/asterisk/modules/quad.so: undefined reference to `csel_get_next'
/usr/lib/asterisk/modules/quad.so: undefined reference to `ast_cli_register_multiple'
/usr/lib/asterisk/modules/quad.so: undefined reference to `ast_tv'
/usr/lib/asterisk/modules/quad.so: undefined reference to `ast_pbx_start'
/usr/lib/asterisk/modules/quad.so: undefined reference to `cm_load'

like this lot of errors are coming.
if usee the option which I posted first i got

test.o: In function `main':
test.c:(.text+0x12): undefined reference to `X1'
test.c:(.text+0x26): undefined reference to `X2'
collect2: ld returned 1 exit status