你的occiCommon.h occiControl.h occi.h这三个文件怎么修改的,我现在只是include之后,编译就出错, d:\oracle\ora92\oci\include\occicontrol.h(1132) : error C2995: 'getVector' : template function has already been defined d:\oracle\ora92\oci\include\occicommon.h(425) : see declaration of 'getVector' d:\oracle\ora92\oci\include\occicontrol.h(1235) : error C2995: 'setVector' : template function has already been defined d:\oracle\ora92\oci\include\occicommon.h(525) : see declaration of 'setVector' d:\oracle\ora92\oci\include\occicontrol.h(1280) : error C2995: 'getVector' : template function has already been defined d:\oracle\ora92\oci\include\occicommon.h(474) : see declaration of 'getVector' d:\oracle\ora92\oci\include\occiobjects.h(640) : error C2995: 'getVector' : template function has already been defined d:\oracle\ora92\oci\include\occicommon.h(353) : see declaration of 'getVector' d:\oracle\ora92\oci\include\occiobjects.h(737) : error C2995: 'setVector' : template function has already been defined d:\oracle\ora92\oci\include\occicommon.h(379) : see declaration of 'setVector' Error executing cl.exe.XTable.exe - 5 error(s), 0 warning(s)这是怎么搞得,因为是oracle自带的东西,我不敢动,可是又不知道什么地方出错?
在别人的帮助下,修改了occiCommon.h occiControl.h occi.h这三个头文件,现在编译通过了,程序运行的时候还是有些问题。
有没有可能是OCI函数用得不对?
错误信息为:Debug Assertion Failed!函数displayAllRows的定义如下:
void displayAllRows ()
{
string sqlStmt = "SELECT author_id, author_name FROM author_tab";
stmt = conn->createStatement (sqlStmt);
ResultSet *rset = stmt->executeQuery ();
try
{
while (rset->next())
{
cout << "author_id: " << rset->getInt (1) << " author_name: " << rset
->getString (2) << endl;
}
}
catch(SQLException ex)
{
cout<<"Exception thrown for displayAllRows"<<endl;
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
}
stmt->closeResultSet (rset);
conn->terminateStatement (stmt);
}
你可以自己试一下,就知道了。
d:\oracle\ora92\oci\include\occicontrol.h(1132) : error C2995: 'getVector' : template function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(425) : see declaration of 'getVector'
d:\oracle\ora92\oci\include\occicontrol.h(1235) : error C2995: 'setVector' : template function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(525) : see declaration of 'setVector'
d:\oracle\ora92\oci\include\occicontrol.h(1280) : error C2995: 'getVector' : template function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(474) : see declaration of 'getVector'
d:\oracle\ora92\oci\include\occiobjects.h(640) : error C2995: 'getVector' : template function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(353) : see declaration of 'getVector'
d:\oracle\ora92\oci\include\occiobjects.h(737) : error C2995: 'setVector' : template function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(379) : see declaration of 'setVector'
Error executing cl.exe.XTable.exe - 5 error(s), 0 warning(s)这是怎么搞得,因为是oracle自带的东西,我不敢动,可是又不知道什么地方出错?
我做的是linux下的,没有这种情况
#include <occiCommon.h>
#endif2 occicommoh.h,调换一下这两条语句的顺序:#define ORASTRING
#include <string>3 occicontrol.h,在语句
#ifdef WIN32COMMON
的后面加上这么一句:
#define WIN32COMMON