Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem Linking Pro*C apps on a RedHat 5.2 Machine

Re: Problem Linking Pro*C apps on a RedHat 5.2 Machine

From: Uwe Schneider <pi_at_nospam.richard-schneider.de>
Date: Sat, 17 Apr 1999 16:06:50 +0200
Message-ID: <3718957A.417E3E20@nospam.richard-schneider.de>


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   | 

Linux - OS al dente! Received on Sat Apr 17 1999 - 09:06:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US