Re: Compiling after Using Pro*C

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 14 May 1998 15:00:37 GMT
Message-ID: <355c0714.4044605_at_192.86.155.100>


A copy of this was sent to Mark Anderson <anderson_at_mitre.org> (if that email address didn't require changing) On Sat, 09 May 1998 16:33:16 -0400, you wrote:

>I am writing my first C program for Oracle using Pro*C 2.0.6 (on Solaris
>2.5.1). When I try to compile the pre-processed .c file, I get the
>following error:
>
>-------------------------------------------------------------------
>Pro*C: Release 2.0.6.0.0 - Production on Sat May 9 16:17:44 1998
>
>Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.
>
>System default option values taken from: /home/ORACLE/proc/pmscfg.h
>
>gcc -I/home/ORACLE/sqllib/public mark1.c
>Undefined first referenced
> symbol in file
>sqlcex /var/tmp/cca000Es1.o
>ld: fatal: Symbol referencing errors. No output written to a.out
>*** Error code 1
>make: Fatal error: Command failed for target `all'
>
>-------------------------------------------------------------------
>
>As you can see, I am am telling the linker to look in
>$ORACLE_HOME/sqllib/public as specified in the Pro*C documentation.
>What am I missing here?

All of the libraries. The easiest way to do this is use a makefile like:



$(TARGET): $(SOURCE) $(SOURCE:.pc=.c) $(SOURCE:.pc=.o)

    $(CC) $(LDFLAGS) -t -o $(TARGET) \

        $(SOURCE:.pc=.o) -L$(ORACLE_HOME)/lib $(PROLDLIBS)

include $(ORACLE_PROC_MAKEFILE)

PROCFLAGS= ireclen=255 lines=yes $(PROC_ENV_FLAGS) \

           include=$(ORACLE_HOME)/proc/lib PROFLAGS=$(PROCFLAGS) CFLAGS=-I. -g $(CC_ENV_FLAGS)


You set up SOURCE as a list of .pc files you want to make into your project and set up TARGET as the name of the executable.

ORACLE_PROC_MAKEFILE should be set according to the version of Oracle you have:

o70:setenv ORACLE_PROC_MAKEFILE $ORACLE_HOME/proc/demo/proc.mk
o71:setenv ORACLE_PROC_MAKEFILE $ORACLE_HOME/proc/demo/proc.mk
o72:setenv ORACLE_PROC_MAKEFILE $ORACLE_HOME/proc/demo/proc.mk
o73:setenv ORACLE_PROC_MAKEFILE $ORACLE_HOME/precomp/demo/proc/proc.mk
o8:setenv ORACLE_PROC_MAKEFILE $ORACLE_HOME/precomp/demo/proc/proc.mk  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu May 14 1998 - 17:00:37 CEST

Original text of this message