2014-10-06 1 views
0

여기 centos 운영 체제에서 occi C++ 응용 프로그램이 있습니다. usr/bin/ld : -locci를 찾을 수 없습니다. collect2 : ld가 1 종료 상태 오류를 리턴했습니다.

또한

Employees.cpp 파일 : - 여기occi C++/usr/bin/ld : -locci를 찾을 수 없습니다. collect2 : ld가 1을 반환했습니다. 종료 상태 compile 시간이 makefile을 사용하여 오류를 발생했습니다.

#include "Employees.h" 
    using namespace std; 
    using namespace oracle::occi; 

    int main (void) 
    { 
     Employees *pEmployees = new Employees(); 
     pEmployees->List(); 
     delete pEmployees; 
     cout << "ENTER to continue..."; 
     cin.get(); 
     return 0; 
    } 

    Employees::Employees() 
    { 
     user = "sys"; 
     passwd = "sis123"; 
     db = "oel01:1521/OEL11GR1.SAND"; 
     env = Environment::createEnvironment(Environment::DEFAULT); 
     try 
     { 
      con = env->createConnection(user, passwd, db); 
     } 
     catch (SQLException& ex) 
     { 
     cout << ex.getMessage(); 
     } 
    } 

    Employees::~Employees() 
    { 
     env->terminateConnection (con); 
     Environment::terminateEnvironment (env); 
    } 

    void Employees::List() 
    { 
     /* 
     * simple test method to select data from 
     * the employees table and display the results 
     */ 
     Statement *stmt = NULL; 
     ResultSet *rs = NULL; 
     string sql = "select employee_id, first_name, last_name " \ 
        "from employees order by last_name, first_name"; 

     try 
     { 
     stmt = con->createStatement(sql); 
     } 
     catch (SQLException& ex) 
     { 
     cout << ex.getMessage(); 
     } 
     if (stmt) 
     { 
     try 
     { 
      stmt->setPrefetchRowCount(32); 
      rs = stmt->executeQuery(); 
     } 
     catch (SQLException& ex) 
     { 
      cout << ex.getMessage(); 
     } 
     con->terminateStatement(stmt); 
     } 
    } 

======================

Employees.h 파일

#include <occi.h> 
#include <iostream> 
#include <iomanip> 
using namespace oracle::occi; 
using namespace std; 
class Employees { 
    public: 
    Employees(); 
    virtual ~Employees(); 
    void List(); 
    private: 
    Environment *env; 
    Connection *con; 
    string user; 
    string passwd; 
    string db; 
}; 

내 메이크 파일은 다음과 같습니다 -

Employees: Employees.cpp 
    g++ -o Employees Employees.cpp \ 
    -I$(ORACLE_HOME)//usr/include/oracle/11.1/client \ 
    -L$(ORACLE_HOME) -lclntsh -locci 

debug: Employees.cpp 
    g++ -ggdb3 -o Employees Employees.cpp \ 
    -I$(ORACLE_HOME)/usr/include/oracle/11.1/client \ 
    -L$(ORACLE_HOME) -lclntsh -locci 
clean: 
    rm -f Employees 

SQLClient 관리의 OCCI 라이브러리가 이미 문제 에 CentOS의 /usr/include/oracle/11.1/client 디렉토리에 설치하는 것은 다음 오라클 헤더의 경로가 (당신의 메이크의 -I 인수에서) $(ORACLE_HOME)//usr/include/oracle/11.1/client 경우 pls는 저에게

+0

'libocci.a' /'libocci.so' 라이브러리는 어디에 있습니까? –

+0

/usr/include/oracle/11.1/이 지령의 클라이언트 –

답변

0

를 도와주세요 파일에 라이브러리 경로가 $(ORACLE_HOME) (메이크 파일의 -L 인수)이 아닐 가능성이 높습니다. $(ORACLE_HOME)//usr/lib/oracle/11.1/client (또는 이와 비슷한 것)이 될 가능성이 훨씬 더 커졌습니다.

+0

내가 만들지 만 같은가요? –

+0

@sis 그러면 올바른 경로가 아닐 수도 있습니다. 올바른 경로가 무엇인지 찾아서 사용해야합니다. 내 의견에 대한 대답을 감안할 때 경로는'/ usr/include/oracle/11.1/client'로 보일 것입니다. (약간 이상하지만 어쩌면 오라클이 일을 할 수도 있습니다.) –

+0

centos occi library에서 알고있는 일반적인 경로는 무엇입니까? –

관련 문제