test.obj : error LNK2001: 外部simple "_sqlcxt" は未解決です
Debug/test.exe : fatal error LNK1120: 外部参照 1 が未解決です。
link.exe の実行エラーtest.exe - エラー 2、警告 0
我的pc程序如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>EXEC SQL BEGIN DECLARE SECTION;    char username[20];
    char password[20];
    char db_string[20];
    
    char test_id[100][10];
    char test_name[100][10];
    char test_date[100][20];
    
EXEC SQL END DECLARE SECTION;
EXEC SQL INCLUDE SQLCA;void sqlerror();main()
{
    int n,i;
    
    /*Log in Database*/
strcpy(username.arr,"chichichi");
username.len=strlen(username.arr);
strcpy(password.arr,"chichichi");
username.len=strlen(password.arr);
strcpy(db_string.arr,"db204");
db_string.len=strlen(db_string.arr);

EXEC SQL WHENEVER SQLERROR DO sqlerror();

EXEC SQL DECLARE DB_NAME DATABASE;

EXEC SQL CONNECT :username IDENTIFIED BY :password 
   AT DB_NAME USING :db_string; 
   
printf("Connected to ORACLE user;%s\n",username.arr);

    EXEC SQL SELECT TESTID,TESTNAME,TESTDATE
        INTO :test_id, :test_name, :test_date
        FROM TEST
        WHERE TESTID=1;
        
    n=sqlca.sqlerrd[2];
    
    for(i=0;i<n;i++)
        printf("%d %-10s\t\t%-10s\t\t%6.2f\n",test_id[i],test_name[i],test_date[i]);
EXEC SQL COMMIT WORK RELEASE;
exit(0);

}void sqlerror()
{
EXEC SQL WHENEVER SQLERROR CONTINUE;
printf("\n%.70s \n",sqlca.sqlerrm.sqlerrmc);

EXEC SQL ROLLBACK WORK RELEASE;
exit(1);
}
使用oracle的pro*c预编译成.c文件

解决方案 »

  1.   

    还有一些头文件要包括进来
    sqlca.h
    ...
    起码还有2个,具体我不记得了并且vc中要设置一下include选项,把oracle中的一个文件包括进来,具体
    要等我回学校后才能告诉你了:(
      

  2.   

    pro*c 怎么debug。将.pc文件预编译成.c文件时, 编译不能通过, 可是oracle一点信息也不提供(oracle的图形化预编译工具)。请问如何对.pc文件进行debug。
      

  3.   

    我已经知道了, 是将$oracle\ora81\precomp\lib\msvc中lib文件包进去就可以了。