请教informix的esql/c编程问题
有一个test.ec文件,内容如下:
#include <stdio.h>
int main()
{
EXEC SQL include sqlca;
EXEC SQL BEGIN DECLARE SECTION;
int nOne = 0;
EXEC SQL END DECLARE SECTION;
EXEC SQL connect to "test";
printf("%d\n", sqlca.sqlcode);
EXEC SQL select one
INTO :nOne
FROM testme;
printf("nOne = %d\n", nOne);
EXEC SQL disconnect current;
return 0;
}
我用esql -c test.ec进行编译,生成test.c和test.o文件。
之后,我用cc test.c -I/usr/informix/incl/esql -o test进行编译,有以下出错提示:
undefined first referenced
symbol in file
_iqconnect test.o
sqlca test.o
_iqslct test.o
_iqdisconnect test.o
i386ld fatal: Symbol referencing errors. No output written to test
但我用esql test.ec -o test编译却能生成test可执行文件,并能正确打印出数据。
请问cc test.c -I/usr/informix/incl/esql -o test为何不能通过编译?因本人刚接触UNIX编程,特向各位请教。谢谢。