在这里,我在 centos 操作系统中有 occi c++ 应用程序。当我使用 make 文件编译我的应用程序时,我得到 /usr/bin/ld: cannot find -locci collect2: ld returned 1 exit status 错误。
Employees.cpp 文件还有:-
#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
centos的/usr/include/oracle/11.1/client目录中已经安装了sqlclient occi库问题出在make文件上请帮助我