|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
在TRU64 UNIX怎麼編譯Proc程序?
CC = cc
CP = cp
MV = mv
RM = rm
ORACLE_HOME=/oracle/app/oracle/product/8.1.7
HOME=/usr
PROC = /oracle/app/oracle/product/8.1.7/bin/proc
PROCFLAGS = oraca=yes code=cpp dbms=v8 parse=partial sqlcheck=semantics userid=zhyz_bill/zhyzbill123
ORA_INCLUDE = -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public\
-I$(ORACLE_HOME)/network/lib \
-I$(ORACLE_HOME)/precomp/public \
-I/usr/include -I.
ORA_PROC_INCLUDE = include=$(ORACLE_HOME)/rdbms/demo include=$(ORACLE_HOME)/rdbms/public \
include=$(ORACLE_HOME)/network/public \
include=$(ORACLE_HOME)/precomp/public \
include=/usr/include include=.
ORA_LIBPATH = -L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib
ORA_LIB = -lagent8 \
-lclient8 \
-lclntst8 \
-lcommon8 \
-lcore8 \
-lctx8 \
-lctxc8 \
-lctxs8 \
-ldbicx8 \
-lgslavl8 \
-lgslber_s8 \
-lgsldb8 \
-lgslr8 \
-lgslsg8 \
-lgslssb8 \
-lgslssf8 \
-lgx8 \
-lldapclnt8 \
-lmm \
-ln8 \
-lnbeq8 \
-lncrypt8 \
-lnent8 \
-lnhost8 \
-lnl8 \
-lnldap8 \
-lnls8 \
-lnoname8 \
-lnro8 \
-lnsgr8 \
-lnsslb8 \
-lntcp8 \
-lntcps8 \
-lntns8 \
-lnus8 \
-lnzjs8 \
-lordim8 \
-lordsdo8 \
-lordts8 \
-lordvir8 \
-lordvirt8 \
-lplc8 \
-lplp8 \
-lpls8 \
-lpsa8 \
-lserver8 \
-lsgsl_s8 \
-lskgxp8 \
-lskgxpd \
-lskgxpu \
-lslax8 \
-lslpm \
-lsql8 \
-lsqlplus \
-lsvrmgrl \
-ltrace8 \
-ltracefe8 \
-ltracepls8 \
-ltracept8 \
-lvsn8 \
-lwtc8 \
-lwtcserver8 \
-lwwg8 \
-lxml8 \
-lxmlg8 \
-lzx8 \
#SOME_DEFINE = -D_DEBUG -D_FOR_UNIX_SYS -D_FOR_AIX_SYS
INCLUDE = -I/usr/include
LIBPATH = -L/usr/lib
all:ryyx_write.cpp ryyx_write.o ryyx_write
ryyx_write.cpp: ryyx_write.pc
$(PROC) $(PROCFLAGS) $(SOME_DEFINE) $(ORA_PROC_INCLUDE) iname=ryyx_write.pc oname=ryyx_write.cpp
ryyx_write.o: ryyx_write.cpp
$(CC) $(INCLUDE) $(ORA_INCLUDE) $(LIBPATH) $(ORA_LIBPATH) -c ryyx_write.cpp $(ORA_LIB)
ryyx_write: ryyx_write.o
$(CC) $(LIBPATH) $(ORA_LIBPATH) -o ryyx_write ryyx_write.o
總是報oraca沒有聲明的錯誤,我還應該包括什麼? |
在TRU64 UNIX怎麼編譯Proc程序?
-lzx8 \
這一行的"\"去掉 |
在TRU64 UNIX怎麼編譯Proc程序?
ORA_LIBPATH下面的一堆ORA_LIB可能於你的系統並不符合。
解決這個問題的辦法是到oracle自己的demo例程下面,編譯一個demo程序,然後把編譯中連接的庫替換你上面的ORA_LIB 中的那一堆東東。 |
在TRU64 UNIX怎麼編譯Proc程序?
在精華中應該有吧
關於oracle的編譯先項說明
另外在faq中也收集了許多ORACLE方面的問題
你看了沒有 |
在TRU64 UNIX怎麼編譯Proc程序?
預編譯已經通過
我用如下代碼實現編譯可執行文件
cc -I. -I/usr/include -I/oracle/app/oracle/product/8.1.7/precomp/public -o ryyx_
write ryyx_write.c -L/usr/lib -L/oracle/app/oracle/product/8.1.7/lib -lclntsh
錯誤代碼如下,是怎麼回事
cc: Error: ryyx_write.c, line 407: In this statement, "oraca" is not declared. )
sqlorat((void **)0, &sqlctx, &oraca);
-------------------------------^
急,請教 :( |
在TRU64 UNIX怎麼編譯Proc程序?
還是oracle的頭文件包含的有問題。 |
在TRU64 UNIX怎麼編譯Proc程序?
頭文件裡ryyx.h聲名
struct yhda_str{
long yhbh[yh_len+1];
Char_12 dhhm[yh_len+1]; /* 電話號碼 */
int zt[yh_len+1]; /* 用戶狀態 */
Char_21 sim[yh_len+1];
Char_17 jszh[yh_len+1];
Char_20 rowid[yh_len+1];
Char_3 xq[yh_len+1];
Char_11 msin[yh_len+1];
int thjb[yh_len+1];
int myzt[yh_len+1];
int qbf[yh_len+1];
struct yhda_str *next;
long yhda_rows;
};
struct yhda_str *yhda_head,*p_yhda;
exec sql include "ryyx.h";
read_yhda()
{
struct yhda_str *yhda;
int i;
exec sql declare yhda_cur cursor for
select substr(a2,6,11)
from yxsr041
order by substr(a2,6,11);
if (sqlca.sqlcode!=0) g_db_err(4);
yhda_head=yhda=(struct yhda_str *)malloc(LEN_yhda);
yhda_head->;next=NULL;
exec sql open yhda_cur;
if (sqlca.sqlcode!=0) g_db_err(5);
for(i=0;;i++)
{
exec sql for :yh_len fetch yhda_cur into
:yhda_dhhm;
if (sqlca.sqlcode<0) g_db_err(6);
if ((sqlca.sqlerrd[2]-yh_len*i)>;0)
yhda->;yhda_rows=sqlca.sqlerrd[2]-yh_len*i;
else
yhda->;yhda_rows=0;
if (sqlca.sqlcode==1403) break;
yhda->;next=(struct yhda_str *)malloc(LEN_yhda);
yhda=yhda->;next;
yhda->;next=NULL;
}
預編譯報著個錯誤
Semantic error at line 171, column 8, file ryyx_write.pc:
:yhda_dhhm;
.......1
PCC-S-02322, found undefined identifier
怎麼會這樣,大俠幫忙 :( |
在TRU64 UNIX怎麼編譯Proc程序?
頭文件裡ryyx.h聲名
struct yhda_str{
long yhbh[yh_len+1];
Char_12 dhhm[yh_len+1]; /* 電話號碼 */
int zt[yh_len+1]; /* 用戶狀態 */
Char_21 sim[yh_len+1];
Char_17 jszh[yh_len+1];
Char_20 rowid[yh_len+1];
Char_3 xq[yh_len+1];
Char_11 msin[yh_len+1];
int thjb[yh_len+1];
int myzt[yh_len+1];
int qbf[yh_len+1];
struct yhda_str *next;
long yhda_rows;
};
struct yhda_str *yhda_head,*p_yhda;
exec sql include "ryyx.h";
read_yhda()
{
struct yhda_str *yhda;
int i;
exec sql declare yhda_cur cursor for
select substr(a2,6,11)
from yxsr041
order by substr(a2,6,11);
if (sqlca.sqlcode!=0) g_db_err(4);
yhda_head=yhda=(struct yhda_str *)malloc(LEN_yhda);
yhda_head->;next=NULL;
exec sql open yhda_cur;
if (sqlca.sqlcode!=0) g_db_err(5);
for(i=0;;i++)
{
exec sql for :yh_len fetch yhda_cur into
:yhda_dhhm;
if (sqlca.sqlcode<0) g_db_err(6);
if ((sqlca.sqlerrd[2]-yh_len*i)>;0)
yhda->;yhda_rows=sqlca.sqlerrd[2]-yh_len*i;
else
yhda->;yhda_rows=0;
if (sqlca.sqlcode==1403) break;
yhda->;next=(struct yhda_str *)malloc(LEN_yhda);
yhda=yhda->;next;
yhda->;next=NULL;
}
預編譯報著個錯誤
Semantic error at line 171, column 8, file ryyx_write.pc:
:yhda_dhhm;
.......1
PCC-S-02322, found undefined identifier
怎麼會這樣,大俠幫忙 :( |
在TRU64 UNIX怎麼編譯Proc程序?
yhda_dhhm這個變量沒有定義。 |
在TRU64 UNIX怎麼編譯Proc程序?
exec sql for :yh_len fetch yhda_cur into
:yhda_dhhm;
我的程序中是這樣的
exec sql for :yh_len fetch yhda_cur into
:yhda->;dhhm;
不過也不能用,錯誤信息
Semantic error at line 170, column 8, file ryyx_write.pc:
:yhda->;dhhm;
.......1
PCC-S-02322, found undefined identifier
Semantic error at line 170, column 8, file ryyx_write.pc:
:yhda->;dhhm;
.......1
PCC-S-02326, illegal structure reference operation
明明是定義了的,它是ryyx.h中定義了阿 |
在TRU64 UNIX怎麼編譯Proc程序?
用下面方法定義一個變量
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR dhhm[yh_len+1];
EXEC SQL END DECLARE SECTION;
作為臨時變量,
exec sql for :yh_len fetch yhda_cur into
:dhhm;
strcpy(yhda->;dhhm,dhhm); |
在TRU64 UNIX怎麼編譯Proc程序?
strcpy(yhda->;dhhm,yx_dhhm); |
在TRU64 UNIX怎麼編譯Proc程序?
能取出yx_dhhm的值嗎?
先打印一下yx_dhhm,看看是什麼! |
在TRU64 UNIX怎麼編譯Proc程序?
不過現在我的函數怎麼只有一條紀錄,我的表裡有9999呢 |
| |