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

Home -> Community -> Usenet -> c.d.o.misc -> Re: ProC & Linux

Re: ProC & Linux

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sun, 28 Mar 1999 14:29:32 GMT
Message-ID: <37063c17.19402008@192.86.155.100>


A copy of this was sent to Andreas Gutowski <andreas.gutowski_at_nk.anzeiger.net> (if that email address didn't require changing) On Sun, 28 Mar 1999 13:41:51 +0200, you wrote:

>Hi,
>
>I am new im programming with ProC.
>
>I've tried to compile a sample programm from OTN under Linux.
>

[snip]

>
>and then I get the following error messages ..
>
>tarsus:/opt/oracle# gcc -o test proc_sample.c
>proc_sample.c:9: parse error before `SQL'
>proc_sample.c:9: warning: data definition has no type or storage class
>proc_sample.c:10: parse error before `v_user'
>proc_sample.c:10: warning: data definition has no type or storage class
>proc_sample.c:13: parse error before `SQL'
>proc_sample.c:13: warning: data definition has no type or storage class
>proc_sample.c: In function `main':
>proc_sample.c:21: `EXEC' undeclared (first use this function)
>proc_sample.c:21: (Each undeclared identifier is reported only once
>proc_sample.c:21: for each function it appears in.)
>proc_sample.c:21: parse error before `SQL'
>proc_sample.c:28: request for member `arr' in something not a structure
>or union
>

It sounds like you are trying to compile the embedded SQL code without having precompiled it.

You would take your code and put it into a .pc file (eg: test.pc). you turn this into C code by:

$ proc test.pc

then, you compile the resulting .c file.

The next issue you'll run into is probably:

$ gcc -o test test.c

Undefined                       first referenced
 symbol                             in file
sqlcxt                              /var/tmp/cctPBcf_1.o
ld: fatal: Symbol referencing errors. No output written to test

that will be because you don't have the pro*c libs linked in.

I've found it easiest to just include the sample makefile included in the precompiler directory and use the symbolic in there to link with. For example, by including the proc sample .mk file, I can simply use " -L$(ORACLE_HOME)/lib $(PROLDLIBS)" in my link line to get the right oracle libs, regardless of version.

This is a makefile template I use alot. I set up the symbolics:

TARGET = name of program I want to create (eg: myprog) SOURCE = list of .pc files I need to precompile/compile (eg: src1.pc src2.pc)

PROC_ENV_FLAGS = any settings I want to override at make time for ProC CC_ENV_FLAGS = any setting I want to override at make time for CC



$(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)



With the exception that the makefile has been renamed/moved from version to version (hence the symbolic ORACLE_PROC_MAKEFILE), this makefile works with 7.x and 8.x. The various settings for the oracle_proc_makefile would be:
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/demo_proc.mk
 




>What's wrong ??
>
>Ciao Guddl
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Andreas Gutowski email: guddl@gmx.de http://www.guddl.de/
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

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



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sun Mar 28 1999 - 08:29:32 CST

Original text of this message

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