g ++:试图执行'jc1'时出错:execvp:没有这样的文件或目录

时间:2017-05-13 12:07:34

标签: c++ oracle11g g++-4.7

我试图使用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;
}

1 个答案:

答案 0 :(得分:0)

您正在与编译器链接 root / Shared / instantclient_11_2_lib /

然后你的#include应该是:

#include <occi.h>

我尝试了你的代码,我的文件只有reapeting错误,包括(解决之后,只是获得更多其他人),所以问题应该在 occi.h 附近。