我无法在ubuntu上编译OCILIB

时间:2017-08-28 14:05:26

标签: c oracle ubuntu gcc

我试图在Ubuntu上使用OCILIB访问Oracle数据库。  我在命令行中使用它:

gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -L/u01/app/oracle/product/11.2.0/xe//lib -lclntsh -I$/home/user/Desktop/ocilib-4.3.1/include -locilib test.c -o con 

但是我收到以下错误:

test.c:(.text+0x20): undefined reference to `OCI_Initialize'
test.c:(.text+0x39): undefined reference to `OCI_ConnectionCreate'
test.c:(.text+0x49): undefined reference to `OCI_StatementCreate'
test.c:(.text+0x5e): undefined reference to `OCI_ExecuteStmt'
test.c:(.text+0x6a): undefined reference to `OCI_GetResultset'
test.c:(.text+0x81): undefined reference to `OCI_GetString'
test.c:(.text+0x95): undefined reference to `OCI_GetInt'
test.c:(.text+0xb5): undefined reference to `OCI_FetchNext'
test.c:(.text+0xbe): undefined reference to `OCI_Cleanup'
collect2: error: ld returned 1 exit status

1 个答案:

答案 0 :(得分:0)

你没有链接到ocilib库。将-llibocilib添加到命令行。