我试图使用g ++编译我的cpp代码,每次我收到此错误:
g++: error trying to exec 'jc1': execvp: No such file or directory.
我正在执行此命令:
g++ -L/root/Shared/instantclient_11_2_lib/* -L $ORACLE_HOME/rdbms/lib/* -L $ORACLE_HOME/lib/* cpp_db_conn.cpp
我的cpp程序包含与oracle db连接的代码。 我的cpp代码如下:
#include <iostream>
#include "/root/instantclient_11_2/sdk/include/occi.h"
using namespace oracle::occi;
using namespace std;
int main(){
oracle::occi::Environment* environment;
oracle::occi::Connection* con;
oracle::occi::Statement* stmt;
oracle::occi::ResultSet* res;
try {
environment = Environment::createEnvironment(Environment::DEFAULT);
con = environment->createConnection("tkmah7u", "root", "XE");
stmt = con->createStatement("select * from customers");
res = stmt->executeQuery();
while (res->next())
std::cout<<res->getInt(1)<<" "<<res->getString(2)<<std::endl;
stmt->closeResultSet(res);
con->terminateStatement(stmt);
environment->terminateConnection(con);
}catch(oracle::occi::SQLException &e){
std::cout<<e.what();
}
return 0;
}
答案 0 :(得分:0)
您正在与编译器链接 root / Shared / instantclient_11_2_lib /
然后你的#include
应该是:
#include <occi.h>
我尝试了你的代码,我的文件只有reapeting错误,包括(解决之后,只是获得更多其他人),所以问题应该在 occi.h 附近。