GCC编译程序出错
[root@licheng ~]# gcc -lsqlora8 ./test.c -o test
最后一次编译成功,但是执行却出现错误首先以root用户执行
[root@licheng ~]# ./test 
./test: error while loading shared libraries: libsqlora8-2.3.so.0: cannot open shared object file: No such file or directory再以oracle用户执行
[oracle@licheng ~]$ ./test
./test: error while loading shared libraries: libsqlora8-2.3.so.0: cannot open shared object file: No such file or directory请教牛人这是怎么回事?
test.c内容如下:
#include <stdio.h>
#include <stdlib.h>
#include "sqlora.h"
static CONST char * _defuser="hr/hr@mydata";
int main(int argc,char **argv)
{
sqlo_db_handle_t dbh;
CONST char * cstr = _defuser;
char server_version[100];
if (SQLO_SUCCESS!= sqlo_init(SQLO_OFF,1,100))
{
printf("Failed to init libsqlora8\n");
return EXIT_FAILURE;
}
if (SQLO_SUCCESS != sqlo_connect(&dbh,cstr))
{
printf("Cannot login with %s \n",cstr);
return EXIT_FAILURE;
}
if (SQLO_SUCCESS != sqlo_server_version(dbh,server_version,sizeof(server_version)))
{
printf("Failed to get the server version: %s\n", sqlo_geterror(dbh));
return EXIT_FAILURE;
}
printf("Connected to:\n%s\n\n", server_version);
}