[英]It shows error message Cannot create OCI environment in my Visual c++
我正在使用Microsoft Visualstudio2015,正在尝试使用OCI函数运行c ++程序,但是我的程序终止了。
我在视觉工作室中设置了ocilib路径,并且成功启动,但是在日志文件中消息初始化失败
#include "ocilib.h"
ofstream LogFile;
LogFile.open("logfile.txt");
void err_handler(OCI_Error *err)
{
if(OCI_ErrorGetType(err) == OCI_ERR_ORACLE)
{
const mtext* sql =OCI_GetSql(OCI_ErrorGetStatement(err));
if(sql != NULL)
{
LogFile<<"ERROR - SQL : "<<sql<<"\n";
}
}
LogFile<<"ERROR - MSG : "<<OCI_ErrorGetString(err)<<endl;
++nbr_error;
}
if(!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
LogFile<<"ERROR - Initialise failed\n";
exit(1);
}
运行该程序后,它显示错误-MSG:无法创建OCI环境程序终止,
我应该怎么办。
从http://www.oracle.com/technetwork/cn/topics/winsoft-085727.html下载instantclient-basic和Instantclient-sdk-windows。
您应该根据程序选择x86或x64版本。 然后解压缩并将它们合并到一个文件夹。
在您的程序中,OCI_Initialize(err_handler, the_folder ,OCI_ENV_DEFAULT)
重新检查环境变量中的OCILIB路径,例如:
Copy ocilib\include\ocilib.h : to a folder listed in the compiler headers folders
Copy ocilib\lib32 |64\ocilib [x].Lib : to a folder listed in the linker libraries folders
Copy ocilib\lib32|64\ocilib [x]. Dll : to a folder included in the PATH environment variable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.