Re: How do I write a Pro*C Program?

From: Naser El-Bathy <nelbathy_at_ford.com>
Date: 17 Oct 2002 09:56:57 -0700
Message-ID: <38ccdbd.0210170856.506f86ac_at_posting.google.com>


Brian Peasland <oracle_dba_at_peasland.com> wrote in message news:<3DADCCC5.B2986B4B_at_peasland.com>...
> Have you installed the Pro*C precompiler on your system? That is the
> first step. After you've installed it, you will find several Pro*C
> examples in $ORACLE_HOME/precomp/demo/proc. Once you have a written
> program, you need to run it through the precompiler with the 'proc'
> utility. This will create your C program for you. Then run this C
> program through your C compiler.
>
> For futher information, please refer to the Oracle docs
> (http://tahiti.oracle.com).
>
> HTH,
> Brian
>
> Naser El-Bathy wrote:
> >
> > Hi,
> >
> > I'm trying to write a very small Pro*C program and I'm trying to run
> > it. However, I have a difficulty writing it.
> >
> > Please, can you write me small program and explain how to run it on
> > UNIX?
> >
> > How to connect it to my database application?
> >
> > Your assistance is appreciated.

Thanks for your assistance. However, I did what you advised me to do and it didn't work.
First of all, I changed directory to proc directory and I used the command proc to run sample1.pc. I got the following: pt8387-oracle% proc sample1

Pro*C/C++: Release 8.0.6.0.0 - Production on Thu Oct 17 12:46:40 2002

(c) Copyright 1999 Oracle Corporation. All rights reserved.

System default option values taken from: /export/ford/pt8387/u/oracle/precomp/ad
min/pcscfg.cfg

Second, I used cc comand to run sample1.c. I got the following: pt8387-oracle% cc sample1.c

"sample1.c", line 151: cannot find include file: <sqlda.h>
"sample1.c", line 152: cannot find include file: <sqlcpr.h>
"sample1.c", line 194: cannot find include file: <sqlca.h>
"sample1.c", line 222: undefined symbol: sqlca
"sample1.c", line 267: undefined symbol: sqlca
"sample1.c", line 295: undefined struct/union member: sqlcode
"sample1.c", line 295: warning: left operand of "." must be
struct/union object
"sample1.c", line 338: undefined symbol: sqlca
"sample1.c", line 382: undefined struct/union member: sqlcode
"sample1.c", line 382: warning: left operand of "." must be
struct/union object
"sample1.c", line 383: warning: left operand of "." must be struct/union object
"sample1.c", line 425: undefined symbol: sqlca
"sample1.c", line 428: undefined struct/union member: sqlcode
"sample1.c", line 428: warning: left operand of "." must be
struct/union object
cc: acomp failed for sample1.c

Please advise. Received on Thu Oct 17 2002 - 18:56:57 CEST

Original text of this message