Home » SQL & PL/SQL » SQL & PL/SQL » PRO*C Problem
PRO*C Problem [message #20017] Wed, 24 April 2002 21:56 Go to next message
Amjath Mohammad
Messages: 3
Registered: April 2002
Junior Member
Hello,
I am a newbie to PRO*C. I have copied a pro*c program from the net, (a .pc file) and using the pro*C editor, pre compiled it into a .c file format. But When I am running the .c file it says, Unable to open SQLCA.h. Undefined symbol &sqlca etc. Please experts tell me how to set up the C environment to run the above program.

Thanks for your time,
Amjath
Re: PRO*C Problem [message #20024 is a reply to message #20017] Thu, 25 April 2002 06:06 Go to previous messageGo to next message
Cindy
Messages: 88
Registered: November 1999
Member
There are two approaches to handle the problem.
----------------------------------------------------------------
SOLUTION #1:
------------------------------------------------------------------
a.pc file you should see #include < sqlca.h > remove it in your a.pc program and add the following before or after all you declared variables:
EXEC SQL INCLUDE sqlca;

EXAMPLE:
$ cat test.pc
#include < stdio.h >

EXEC SQL INCLUDE sqlca;

main()
{
printf("This is a testn");
return(0);
}
===========================================================
$ proc test.pc

Pro*C/C++: Release 8.1.7.2.0 - Production on Thu Apr 25 09:35:26 2002

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

System default option values taken from: /u01/app/oracle/product/8.1.7/precomp/g

===============================================================
You will see test.c file. Compile the test.c program
===============================================================
$ cc test.c -o test.out

$ ls test*
test.c test.lis test.out test.pc

============================================
Run executable file: test.out
============================================
$ test.out
This is a test

--------------------------------------------------------------

SOLUTION #2:

----------------------------------------------------------------
Create a makefile.

================================================================
test.pc
================================================================
$ cat test.pc
#include < stdio.h >
#include < sqlca.h >

main()
{
printf("This is a testn");
return(0);
}
$
=================================================================

$ rm test.c test.lis test.out
==============================================================
Example of makefile:
==============================================================
$ more test.mk
CC=/usr/bin/cc
ORACLE_HOME=/u01/app/oracle/product/8.1.7
PROC=$(ORACLE_HOME)/bin/proc
TARGET=test.out
SOURCE=test.pc


$(TARGET): $(SOURCE) $(SOURCE:.pc=.c) $(SOURCE:.pc=.o)
$(CC) $(LDFLAGS) -o $(TARGET)
$(SOURCE:.pc=.o) -L$(ORACLE_HOME)/lib $(PROLDLIBS)

include $(ORACLE_HOME)/rdbms/demo/demo_rdbms.mk


=================================================================
$ make -f test.mk

$ ls test*
test.c test.lis test.mk test.o test.out test.pc
$ test.out
This is a test

======================================================

Info on makefile:
http://www.gnu.org/manual/make/html_mono/make.html
UNSUBSCRIBE [message #20041 is a reply to message #20024] Thu, 25 April 2002 21:30 Go to previous messageGo to next message
Olcay Yenilmez
Messages: 2
Registered: April 2002
Junior Member
UNSUBSCRIBE
Re: PRO*C Problem [message #20249 is a reply to message #20024] Wed, 08 May 2002 21:59 Go to previous message
Amjath Mohammad
Messages: 3
Registered: April 2002
Junior Member
Thanks Cindy,
But I could not understand most of your comments ( I am totally new to Pro C). In my Ora81/bin folder I don't have any exe files like proc.exe ( I mean, cc or cat or ls), those you have used with the $ symbol. If i have misunderstood please explain me in detail.

Thanks,
Amjath.
Previous Topic: Problem with trigger
Next Topic: Re: Pro*C
Goto Forum:
  


Current Time: Fri Apr 26 17:15:31 CDT 2024