mymotif@mymotif-ThinkPad-X240:~/prg/embc/ora$ g++ -I${ORACLE_HOME}/sdk/include
-L${ORACLE_HOME}/lib -lclntsh -o ociTest ociTest.cpp
/tmp/ccb8nVWk.o:在函数‘main’中:
ociTest.cpp:(.text+0xcf):对‘OCIEnvCreate’未定义的引用
ociTest.cpp:(.text+0x14f):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x175):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x1be):对‘OCIServerAttach’未定义的引用
ociTest.cpp:(.text+0x22c):对‘OCIErrorGet’未定义的引用
ociTest.cpp:(.text+0x27a):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x28e):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x2a2):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x36b):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x391):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x3c1):对‘OCIAttrSet’未定义的引用
ociTest.cpp:(.text+0x3e7):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x438):对‘OCIAttrSet’未定义的引用
ociTest.cpp:(.text+0x489):对‘OCIAttrSet’未定义的引用
ociTest.cpp:(.text+0x4b1):对‘OCISessionBegin’未定义的引用
ociTest.cpp:(.text+0x514):对‘OCIErrorGet’未定义的引用
ociTest.cpp:(.text+0x562):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x576):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x58a):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0x5e0):对‘OCIAttrSet’未定义的引用
ociTest.cpp:(.text+0x611):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x682):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0x727):对‘OCIStmtPrepare’未定义的引用
ociTest.cpp:(.text+0x824):对‘OCIDefineByPos’未定义的引用
ociTest.cpp:(.text+0x887):对‘OCIDefineByPos’未定义的引用
ociTest.cpp:(.text+0x8b7):对‘OCIAttrGet’未定义的引用
ociTest.cpp:(.text+0x8f5):对‘OCIStmtExecute’未定义的引用
ociTest.cpp:(.text+0x967):对‘OCIStmtFetch2’未定义的引用
ociTest.cpp:(.text+0x9a1):对‘OCIAttrGet’未定义的引用
ociTest.cpp:(.text+0x9f3):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0xa64):对‘OCIHandleAlloc’未定义的引用
ociTest.cpp:(.text+0xb42):对‘OCIStmtPrepare’未定义的引用
ociTest.cpp:(.text+0xbdd):对‘OCIStmtExecute’未定义的引用
ociTest.cpp:(.text+0xbf6):对‘OCILogoff’未定义的引用
ociTest.cpp:(.text+0xc14):对‘OCIServerDetach’未定义的引用
ociTest.cpp:(.text+0xc28):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0xc3c):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0xc50):对‘OCIHandleFree’未定义的引用
ociTest.cpp:(.text+0xc64):对‘OCIHandleFree’未定义的引用
collect2: error: ld returned 1 exit status
mymotif@mymotif-ThinkPad-X240:~/prg/embc/ora$ g++ -o ociTest ociTest.cpp -I${ORACLE_HOME}/sdk/include
-L${ORACLE_HOME}/lib -lclntsh
mymotif@mymotif-ThinkPad-X240:~/prg/embc/ora$ ./ociTest
Oracle environment initialization success!
Oracle server attach success!
user session success!
Create stmt success !
Create prepare success!
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
Create stmt success !
Create prepare success!
ociTest.cpp(双引号改为尖括号)
#include "oci.h"
#include "iostream"
#include "string"
#include "string.h"
#include "stdlib.h"
using namespace std;
//存放查询数据的结构体
struct result
{
};
int main()
{
}