请给个详细答案,谢谢!!!
当parse=full转换parse=none/partial时的错误:
设置:
#include<iostream>
using namespace std;
printf 改为 cout
错误如下:
Performing Custom Build Step on ..\demo.pc
Pro*C/C++: Release 10.1.0.2.0 - Production on 星期日 10月 5 22:03:38 2008
Copyright (c) 1982, 2004, Oracle. All rights reserved.
系统默认选项值取自于: C:\oracle\product\10.1.0\db_1\precomp\admin\pcscfg.cfg
在第 14 行, 第 28 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL select sal INTO :salary from emp where ename=:name;
...........................1
PCC-S-02322, 找到未定义的标识符
在第 14 行, 第 57 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL select sal INTO :salary from emp where ename=:name;
........................................................1
PCC-S-02322, 找到未定义的标识符
在第 27 行, 第 19 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL CONNECT :username IDENTIFIED BY :password ;
..................1
PCC-S-02322, 找到未定义的标识符
在第 27 行, 第 43 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL CONNECT :username IDENTIFIED BY :password ;
..........................................1
PCC-S-02322, 找到未定义的标识符
Error executing c:\windows\system32\cmd.exe.demo.c - 1 error(s), 0 warning(s)
当parse=full转换parse=none/partial时的错误:
设置:
#include<iostream>
using namespace std;
printf 改为 cout
错误如下:
Performing Custom Build Step on ..\demo.pc
Pro*C/C++: Release 10.1.0.2.0 - Production on 星期日 10月 5 22:03:38 2008
Copyright (c) 1982, 2004, Oracle. All rights reserved.
系统默认选项值取自于: C:\oracle\product\10.1.0\db_1\precomp\admin\pcscfg.cfg
在第 14 行, 第 28 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL select sal INTO :salary from emp where ename=:name;
...........................1
PCC-S-02322, 找到未定义的标识符
在第 14 行, 第 57 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL select sal INTO :salary from emp where ename=:name;
........................................................1
PCC-S-02322, 找到未定义的标识符
在第 27 行, 第 19 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL CONNECT :username IDENTIFIED BY :password ;
..................1
PCC-S-02322, 找到未定义的标识符
在第 27 行, 第 43 列, 文件 \Study\vc60_oracle\demo.pc 有语义错误:
EXEC SQL CONNECT :username IDENTIFIED BY :password ;
..........................................1
PCC-S-02322, 找到未定义的标识符
Error executing c:\windows\system32\cmd.exe.demo.c - 1 error(s), 0 warning(s)
宿主变量应放入定义块中如下:
EXEC SQL BEGIN DECLARE SECTION;
放宿主变量:
....
EXEC SQL END DECLARE SECTION;==================================
源码如下:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sqlca.h>
#include<iostream>
using namespace std;int main(void)
{
EXEC SQL BEGIN DECLARE SECTION;
char username[10],password [10];
EXEC SQL END DECLARE SECTION;
cout<<"UserName:";
cin>>username;
cout<<"\nPassword:";
cin>>password;
EXEC SQL CONNECT :username IDENTIFIED BY :password;
if(sqlca.sqlcode==0)
cout<<"ok"<<endl;
else
{
cout<<"error begin"<<endl;
cout<<sqlca.sqlerrm.sqlerrml<<endl;
cout<<sqlca.sqlerrm.sqlerrmc<<endl;
cout<<"error end"<<endl;
}
return 0;
}
配置如下:
define=(WIN32_LEAN_AND_MEAN)
sqlcheck=full
parse=partial
cpp_suffix=cpp
userid=scott/scottpwd@orag
include=C:\oracle\product\10.1.0\db_1\OCI\include
include=C:\oracle\product\10.1.0\db_1\precomp\public
include="C:\Program Files\Microsoft Visual Studio\VC98\Include"错误如下:
cannot compile the file 'D:\study\vc60_oracle\demo.pc':no compile tool
is associated with the file extension.请给点意见!
#include<iostream>
using namespace std;//#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sqlca.h>void connect();
void select();
void insert();
void update();
void delet();
void sql_error();int main(void)
{
char action;
EXEC SQL WHENEVER SQLERROR DO sql_error();
connect();
if(sqlca.sqlcode != 0)
{
sql_error();
EXEC SQL COMMIT RELEASE;
cout<<"commit!"<<endl;
return 1;
}
for(;;)
{
cout<<"\ns:查找雇员名,i:增加雇员,u:修改工资,d:删除雇员,q:推出: ";
cout<<"\n请输入要执行的操作:";
cin>>action;
switch(action)
{
case's':
case 'S':
select();
break;
case 'i':
case 'I':
insert();
break;
case 'u':
case 'U':
update();
break;
case 'd':
case 'D':
delet();
break;
case 'q':
case 'Q':
EXEC SQL COMMIT RELEASE;
exit(1); }
}
return 0;
}
void connect()
{
EXEC SQL BEGIN DECLARE SECTION;
char username[10],password [10];
EXEC SQL END DECLARE SECTION; cout<<"username:";
cin>>username;
cout<<"password:";
cin>>password;
EXEC SQL CONNECT :username IDENTIFIED BY :password;
}
void sql_error()
{
cout<<sqlca.sqlerrm.sqlerrml<<endl;
cout<<sqlca.sqlerrm.sqlerrmc<<endl;
}
/*
username:wert
password:wert
sql_error
//在EXEC SQL COMMIT RELEASE以前
ORA-01017: invalid username/password; logon denied
sql_error
ORA-01012: 没有登录 //在EXEC SQL COMMIT RELEASE以后
Press any key to continue
*/
void select()
{
EXEC SQL BEGIN DECLARE SECTION;
int eno;
char name[10];
EXEC SQL END DECLARE SECTION;
cout<<"请输入雇员号:";
cin>>eno;
strcpy(name,"");
EXEC SQL CALL get_name(:eno,:name);
cout<<"雇员名:"<<name<<endl;
}
void insert()
{
cout<<"Insertting."<<endl;
}
void update()
{
cout<<"Updateing."<<endl;
}
void delet()
{
cout<<"Delet."<<endl;
}
pcscfg.cfg配置如下:
define=(WIN32_LEAN_AND_MEAN)
code=cpp
cpp_suffix=cpp
cpp_suffix=cpp
include=C:\oracle\product\10.1.0\db_1\OCI\include
include=C:\oracle\product\10.1.0\db_1\precomp\public
include="C:\Program Files\Microsoft Visual Studio\VC98\Include"
==================================================
demo_cpp.cp的Custom Build的
Commands: proc $(InputDir)\$(InputName)
Output: $(InputDir)\$(InputName).cpp
============================================
vc++6.0的配置如下:
Tools->Options->Directories
->Show directories for:Include files
C:\ORACLE\PRODUCT\10.1.0\DB_1\PROCOMP\PUBLIC
C:\ORACLE\PRODUCT\10.1.0\DB_1\OCI\INCLUDE
->Show directories for:Executable files
C:\ORACLE\PRODUCT\10.1.0\DB_1\BIN错误如下:
--------------------Configuration: democpp - Win32 Debug--------------------
Performing Custom Build Step on ..\demo_cpp.pc
Pro*C/C++: Release 10.1.0.2.0 - Production on 星期日 10月 12 21:51:59 2008
Copyright (c) 1982, 2004, Oracle. All rights reserved.
系统默认选项值取自于: C:\oracle\product\10.1.0\db_1\precomp\admin\pcscfg.cfg
Compiling...
demo_cpp.c
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
Error executing cl.exe.democpp.exe - 1 error(s), 0 warning(s)安装时有pro*c/c++组件,可在开始菜单中却找不到它.它可以编译C程序,为何不能编译C++程序?
谁能帮我解决这麽高深的难题?
万分感谢!!!