Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Problem Linking Pro*C apps on a RedHat 5.2 Machine
Hi Chuck,
Chuck wrote:
>
> I am new to Pro*C and Oracle development and I am trying to
> develop some simple applications that query my 805 database
> running on a RedHat 5.0.2 machine.
>
> The code precompiles without any problems using Oracle's
> precompiler, proc.
>
> I then try and compile the resulting source file with GCC
> 2.7.2.3 and get complaints about undefined references which
> I am sure are caused by a library I am not linking. I have
> tried linking just about every library in the Oracle lib
> directories to no avail.
>
> What would be the exact syntax I would use to link this library
> during compile time? Also, I have collected nearly every piece
> of Oracle documentation I can find and everything refers to this
> library as LIBSQL. I am no stranger to linking libraries and using
> the GCC compiler, but the answer to this eludes me.
there are example Makefiles provided with Oracle 8.05/Pro*C. Look at them for a first approach. They link the objects against a lot of (repeating) libraries.
After experimenting for a while I found out the minimal set of libraries and object files to be included with simple Pro*C programs. My Makefile contains the following statement:
ORALIB=$(ORACLE_HOME)/lib
ORA_LDFLAGS=-L$(ORALIB) \
$(ORALIB)/scorept.o \
$(ORACLE_HOME)/rdbms/lib/kpudfo.o \
-lclntsh \ -lclient \ -lcore4 \ -lnlsrtl3 \ -lnetv2
LDFLAGS = $(ORA_LDFLAGS) -ldl -lm
sample1: sample1.o
$(CC) -o $@ $< $(LDFLAGS)
This should be appropriate for you although I do use SuSE Linux.
Uwe
--
Uwe Schneider | Telefon +49 7251 / 82587 Karlsdorfer Str. 31 | Mail pi_at_richard-schneider.de DE-76646 Bruchsal |