编译出现错误
在win下安装来informix client-sdk,配置完成之后也能连接上服务器上的数据库informix测试esql/c一段代码来连接数据库,先用esql并生成来.c文件
#include <stdio.h>
#include <stdlib.h>
/*建立通讯区域*/
EXEC SQL include sqlca;
int main(int argc, char *argv[])
{
/*声明宿主变量*/
EXEC SQL BEGIN DECLARE SECTION;
char dbname;
char user;
char pswd;
char user_name;
EXEC SQL END DECLARE SECTION;
sprintf(dbname,"mydb@infoserver");
sprintf(user,"informix");
sprintf(pswd,"informix");
EXEC SQL CONNECT TO :dbname user :user using :pswd;
if( sqlca.sqlcode )
{
printf("Connect [%s] Error,ErrorCode=%d\n",dbname);
return -1;
}
printf("---[%d]---\n",sqlca.sqlcode);
EXEC SQL CLOSE DATABASE;
return 0;
}
然后用vc++6.0编译,出现了问题:
Linking...
main.obj : error LNK2001: unresolved external symbol _sqli_db_close
main.obj : error LNK2001: unresolved external symbol _fnsqlca
main.obj : error LNK2001: unresolved external symbol _ifx_free_conn_user
main.obj : error LNK2001: unresolved external symbol _sqli_connect_open
main.obj : error LNK2001: unresolved external symbol _ifx_alloc_conn_user
这是什么原因? 问题解决了!
原来没有引入库文件
页:
[1]