编译proc出错,帮帮我

full-stack-coder 2008-10-21 10:56:23
这个是proc源代码
#include<iostream>
using namespace std;

EXEC SQL BEGIN DECLARE SECTION;
char userid[20]="chaijing/cj456";
char v_name[5];
short ind_name;
int v_id;
EXEC SQL END DECLARE SECTION;
EXEC SQL INCLUDE sqlca;

void sqlerror();

int main(){
EXEC SQL WHENEVER SQLERROR DO sqlerror();
EXEC SQL CONNECT :userid;
cout << "enter id: ";
cin >> v_id;

EXEC SQL
SELECT first_name
INTO :v_name:ind_name
FROM s_emp
WHERE id = :v_id;

EXEC SQL COMMIT WORK RELEASE;
cout << "hello, " << v_name << endl;
cout << "ind_name: " << ind_name << endl;
return 0;
}

void sqlerror(){
EXEC SQL WHENEVER SQLERROR CONTINUE;
cout << sqlca.sqlerrm.sqlerrmc << endl;
EXEC SQL ROLLBACK WORK RELEASE;
exit(-1);
}

预编译proc
proc hello.pc oname=hello.cc parse=none

编译:g++ -o hello hello.cc -lclntsh
到这一步骤就出错了。
hell.cc:117: error: ISO C++ forbids declaration of `sqlcxt' with no type
hell.cc:119: error: ISO C++ forbids declaration of `sqlcx2t' with no type
hell.cc:121: error: ISO C++ forbids declaration of `sqlbuft' with no type
hell.cc:122: error: ISO C++ forbids declaration of `sqlgs2t' with no type
hell.cc:123: error: ISO C++ forbids declaration of `sqlorat' with no type
hell.cc: In function `int main()':
hell.cc:117: error: too many arguments to function `int sqlcxt()'
hell.cc:299: error: at this point in file
hell.cc:117: error: too many arguments to function `int sqlcxt()'
hell.cc:352: error: at this point in file
hell.cc:117: error: too many arguments to function `int sqlcxt()'
hell.cc:372: error: at this point in file
hell.cc: In function `void sqlerror()':
hell.cc:117: error: too many arguments to function `int sqlcxt()'
hell.cc:400: error: at this point in file

帮帮我、





...全文
206 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shenye_jar 2012-05-02
  • 打赏
  • 举报
回复
几年前的问题了,我现在也碰到这样的情况,你当时是怎么解决的,请问?
mosaic 2008-10-21
  • 打赏
  • 举报
回复
没看懂,你编译的是hello.cc,为什么出错信息里面都是hell.c?
hell.cc:117:
...
范佩西_11 2008-10-21
  • 打赏
  • 举报
回复
你看下报错语句吗sqlcxt,那几个变量没有声明类型。
full-stack-coder 2008-10-21
  • 打赏
  • 举报
回复
小弟在线等。。。
full-stack-coder 2008-10-21
  • 打赏
  • 举报
回复
不好意思,写掉了一个o,添加上也是一样的啊

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧