编译proc出错,帮帮我
这个是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
帮帮我、