Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: "Error occur while using SQLDA and linking libsql.a in UNIX"
In article <38595790.BFECBA49_at_Unforgettable.com>,
Kenneth C Stahl <BlueSax_at_Unforgettable.com> wrote:
> oraleewk_at_my-deja.com wrote:
> >
> > hello all,
> >
> > When I was implementing dynamic method 4 and
> > using SQLDA in Oracle 7 under UNIX environment.
> > The code passed compile but linking error occured
> > at the end.
> >
> > //====Problem Description=====
> > The linker was complaining that
> > ld: 0711-317 ERROR: Undefined symbol: .sqlda(int,
> > unsigned int, unsigned int)
> >
> > Besides, more detail information generated by ld
> > is as below.
> >
> > (ld): lib
> > /fads/cots/appl/oracle/product/v1/7.3/lib/libsql.a
> > (ld): lib
> > /fads/cots/appl/oracle/product/v1/7.3/lib/libsqlne
> > t.a
> > .
> > .
> > .
> >
> > (ld): i dbConvert.o
> > .
> > .
> >
> > ld: 0711-318 ERROR: undefined symbols were found.
> >
> > Symbol Inpndx TY CL Source-File
> > -----------------------------------------------
> > .sqlald__FiUiT2 [104] ER PR dbConvert.cpp
> >
> > //==== Question ? ========
> > But, it confuses me very much that although the
> > required library "libsql.a" was linked before the
> > calling object "dbConvert.o", the undefined symbol
> > linking error still exists.
> >
> > Even, I ever tried to extract sqlda.o from
> > libsql.a to do manual linking, the error just
> > won't go away.
> >
> > //==== Wonder ? =========
> > Did anybody ever encounter the similar problem
> > while working with oracle in UNIX environment ?
> >
> > Your Help will be highly appreciated !
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> SQLDA is the name of a structure and it is uppercase in the header
file.
> sqlald() is a function which initializes an SQLDA structure.
>
> The error messages you've shown above seems to indicate that you are
doing
> a C++ compile since the name is mangled. Are you sure that you are
doing a
> precompile with mode=cpp?
>
> Beyond that , show your source code so that we can see what is going
on.
>
> .....................................................................
> .....................................................................
My partial Makefile ====================
.SUFFIXES: .o .cpp .PC
.PC .o:
$(PROC) $(PROFLAGS) iname=$*.PC $(CC) $(C++FLAGS) -c $*.cpp
PROFLAGS=include=$(PCCINC) include=$(SYSINC) ireclen=255 oreclen=134 hold_cursor=no CODE=CPP CPP_SUFFIX=cpp SQLCHECK=FULL USERID=/
TARGET = dbConvert
C++FLAGS = $(DEBUGFLAGS) -I./ -I$(INC) $(SYSFLAG) -I$(SYSINCPROC) all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) -L(ORACLE_HOME)/lib $(ORALIBS) $(OBJS)
-L$(LIBS) -bloadmap:$(HOME)/CR/ld_result
My partial Source code
#include <stdio.h> #include <sqlda.h> #include <sqlcpr.h>
extern "C"
{
int DBLogin();
void DBLogout();
}
EXEC SQL INCLUDE SQLCA;
EXEC SQL INCLUDE SQLDA;
extern SQLDA *sqlald();
int dbCvt()
{
int ret_code=0;
EXEC SQL BEGIN DECLARE SECTION
VARCHAR statement[500];
EXEC SQL END DECLARE SECTION
SQLDA *s_dp;
s_dp = sqlald(30, (size_t)30, (size_t)30); s_dp->N=300;
//sqlclu(s_dp);
sqlerrors:
ret_code=(int)sqlca.sqlcode;
EXEC SQL WHENEVER SQLERROR CONTINUE; return(ret_code);
}
void main(void)
{
int ret_code=0;
ret_code = DBLogin();
dbCvt();
DBLogout();
}
Typo
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Dec 17 1999 - 17:02:28 CST