linux libfcmain.so,如何在Linux上使用C++查询Informix数据库?使用C++的对象接口时出现编译器错误...

我使用IBM提供的C++ Object Interface编写了以下代码。我正在尝试在RHEL(Linux)上进行编译:

#include

#include

int main() {

ITDBInfo db("dbname","user","pwd","system");

ITConnection conn(db);

conn.Open();

if ( conn.Error() ) {

cout << "Couldn't open connection" << endl;

return -1;

}

ITQuery query( conn );

ITRow *row;

if( !(row = query.ExecOneRow( "select lname from customer;" )) ) {

cout << "Couldn't select from table customer" << endl;

return -1;

}

while ((row = query.NextRow()) != NULL) {

cout << row->Printable() << endl;

}

row->Release();

conn.Close();

}在Linux上编译时如下所示:

g++ -Wno-deprecated -I/opt/Informix/11.5FC8/incl/c++ \

-I/opt/Informix/11.5FC8/incl/public \

-L/opt/Informix/11.5FC8/lib/c++ -g -o test1 test1.cpp我收到如下所示的错误:

/tmp/cchJkPb1.o: In function `main':

test1.cpp:(.text+0x82): undefined reference to `ITString::ITString(char const*)'

test1.cpp:(.text+0x90): undefined reference to `ITString::ITString(char const*)'

test1.cpp:(.text+0x9e): undefined reference to `ITString::ITString(char const*)'

test1.cpp:(.text+0xac): undefined reference to `ITString::ITString(char const*)'

test1.cpp:(.text+0xc8): undefined reference to `ITDBInfo::ITDBInfo(ITString const&, ITString const&, ITString const&, ITString const&)'

test1.cpp:(.text+0xd1): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0xea): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0xfc): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0x115): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0x127): undefined reference to `ITString::~ITString()'

/tmp/cchJkPb1.o:test1.cpp:(.text+0x140): more undefined references to `ITString::~ITString()' follow

/tmp/cchJkPb1.o: In function `main':

test1.cpp:(.text+0x15f): undefined reference to `ITConnection::ITConnection(ITDBInfo const&)'

test1.cpp:(.text+0x178): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0x194): undefined reference to `ITConnection::Open()'

test1.cpp:(.text+0x19d): undefined reference to `ITErrorManager::Error() const'

test1.cpp:(.text+0x1e6): undefined reference to `ITQuery::ITQuery(ITConnection const&)'

test1.cpp:(.text+0x1f4): undefined reference to `ITString::ITString(char const*)'

test1.cpp:(.text+0x209): undefined reference to `ITQuery::ExecOneRow(ITString const&, ITEssential**)'

test1.cpp:(.text+0x222): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0x23b): undefined reference to `ITString::~ITString()'

test1.cpp:(.text+0x2a6): undefined reference to `operator< >&, ITString const&)'

test1.cpp:(.text+0x2c4): undefined reference to `ITQuery::NextRow(ITEssential**)'

test1.cpp:(.text+0x2f1): undefined reference to `ITConnection::Close()'

test1.cpp:(.text+0x317): undefined reference to `ITQuery::~ITQuery()'

test1.cpp:(.text+0x32c): undefined reference to `ITQuery::~ITQuery()'

test1.cpp:(.text+0x366): undefined reference to `ITConnection::~ITConnection()'

test1.cpp:(.text+0x378): undefined reference to `ITConnection::~ITConnection()'

test1.cpp:(.text+0x3b2): undefined reference to `ITDBInfo::~ITDBInfo()'

test1.cpp:(.text+0x3ce): undefined reference to `ITDBInfo::~ITDBInfo()'

collect2: ld returned 1 exit status目录/opt/Informix/11.5FC8/lib/c++列在LD_LIBRARY_PATH中。任何人都可以帮助我摆脱这些错误?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值