g++: error trying to exec 'jc1': execvp: No such file or directory

615 views Asked by At

I was trying to compile my cpp code using g++ and every time i am getting this error:

g++: error trying to exec 'jc1': execvp: No such file or directory.

I am executing this command:

g++  -L/root/Shared/instantclient_11_2_lib/* -L $ORACLE_HOME/rdbms/lib/* -L $ORACLE_HOME/lib/* cpp_db_conn.cpp

My cpp programme contains code for connection with oracle db. My cpp code is given below:

#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

There are 1 answers

0
Rapido On

You are linking with the compiler root/Shared/instantclient_11_2_lib/

Then your #include should be :

#include <occi.h>

I tried your code and I had only reapeting error on your file including (after solving, just get more others), so the problem should be somewhere around occi.h.