|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
aix433上創建和調用共享庫的問題。
testlib.cpp:
#include <iostream>;
bool aorb(int a)
{
if (a >; 5)
return true;
else
return false;
}
testlib.和:
extern "C" {
bool aorb(int a);
}
test.cpp:
#include <stdio.h>;
#include "testlib.h"
int main()
{
if (aorb(6)) printf(">;5\n");
else printf("<5\n");
return 0;
}
xlC -o libtestlib.so testlib.cpp生成共享庫文件沒有問題.
但在test.cpp種調用共享庫中的函數報錯如下:
ld: 0706-006 Cannot find or open library file: -l testlib
ld:open(): No such file or directory
編譯命令如下:
xlC -o test test.cpp -L/ora8_data/lizhj/test -ltestlib
路徑指向沒有問題,大家幫忙分析一下錯誤的原因,謝謝。 |
aix433上創建和調用共享庫的問題。
是不是庫路徑沒設,用export設一把看看 |
| |