Home » Developer & Programmer » Precompilers, OCI & OCCI » Can't compile Pro*C code with 11g
Can't compile Pro*C code with 11g [message #308384] Mon, 24 March 2008 03:18 Go to next message
awaken77
Messages: 2
Registered: March 2008
Junior Member
Hello!
I have a bunch of old code, which was written for Oracle 9&10 on solaris initially.
Now I'm trying to port it to Linux environment, where 11g is installed.
When trying to compile .pc to .C files, preprocessor throws many compilation errors.
my goal is compile .pc to .cc, which will be compiled then with GCC 4.1.2 c++ compiler

This is a proc command from my makefile with options I use:

PROC_DIR = $(ORA_DIR)/bin
PROC = $(PROC_DIR)/proc $(ORA_DIR)
PROC_FLAGS = \
INCLUDE=/usr/include \
INCLUDE=/usr/include/sys \
INCLUDE=/usr/include/c++/4.1.2 \
INCLUDE=/usr/lib/gcc/i386-redhat-linux/4.1.2/include \
INCLUDE=/usr/include/c++/4.1.2/i386-redhat-linux \
INCLUDE=/usr/include/asm \
INCLUDE=$(MY_ROOT)/DataAccess/include \
INCLUDE=../include \
INCLUDE=$(IDL_DIR)/include \
INCLUDE=/usr/local/include \
INCLUDE=/usr/local/include/tao \
INCLUDE=$(ORA_DIR)/precomp/public \
INCLUDE=$(ORA_DIR)/rdbms/public \
CODE=CPP \
THREADS=YES \
$(PROC_OPTS) \
DBMS=V8 \
LINES=YES \
HOLD_CURSOR=YES \
RELEASE_CURSOR=NO \
MODE=ANSI \
SQLCHECK=SYNTAX \
PARSE=NONE \
DEFINE=ORACLE


I'm a C++ programmer and not familiar with pro*c. but this code was written long ago and worked for years, so I'm not going to rewrite it to rather normal C++ - I have to make it "buildable" in new Linux environment.

heree are errors:

Semantic error at line 58, column 31, file AirportCity.pc:
char airportCityCodeArray [ FETCH_SIZE ] [4];
..............................1
PCC-S-02322, found undefined identifier
Semantic error at line 59, column 27, file AirportCity.pc:
char descriptionArray [ FETCH_SIZE ] [41];
..........................1
PCC-S-02322, found undefined identifier
Semantic error at line 61, column 33, file AirportCity.pc:
char stateProvinceCodeArray [ FETCH_SIZE ] [3];
................................1


all are related to host variables, declared like this:

// Host variables
//
EXEC SQL BEGIN DECLARE SECTION;

const char *airportCityCode;
char airportCityCodeArray [ FETCH_SIZE ] [4];
char descriptionArray [ FETCH_SIZE ] [41];
char countryCodeArray [ FETCH_SIZE ] [3];
char stateProvinceCodeArray [ FETCH_SIZE ] [3];
char geocodeAccuracyCodeArray [ FETCH_SIZE ] [7];
float latitudeArray [ FETCH_SIZE ];
float longitudeArray [ FETCH_SIZE ];

// indicators for columns which allow nulls
short description_ind [ FETCH_SIZE ];
short countryCode_ind [ FETCH_SIZE ];
short stateProvinceCode_ind [ FETCH_SIZE ];
short latitude_ind [ FETCH_SIZE ];
short longitude_ind [ FETCH_SIZE ];

EXEC SQL END DECLARE SECTION;


where FETCH_SIZE is a #define FETCH_SIZE 100


p.s.
my environment:
OS - Fedora 8, Linux kernel version 2.6.24.3-34.fc8
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
ORADIR=/opt/app/oracle/product/11.1.0/client_1/

[Updated on: Mon, 24 March 2008 03:23]

Report message to a moderator

Re: Can't compile Pro*C code with 11g [message #308396 is a reply to message #308384] Mon, 24 March 2008 03:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Are you sure the precompiler see your define?

Also read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use the "Preview Message" button to verify.

Regards
Michel
Re: Can't compile Pro*C code with 11g [message #308401 is a reply to message #308396] Mon, 24 March 2008 03:55 Go to previous messageGo to next message
awaken77
Messages: 2
Registered: March 2008
Junior Member
>Are you sure the precompiler see your define?

it seems not.
I removed #define and substituted it by magic number.
but code constants doesn't work too
example:
const int FETCH_SIZE = 100;

  EXEC SQL BEGIN DECLARE SECTION;
	char attributeType [ 3 ] ;
	char attributeCode [ 3 ] ;
	char codeArray [ FETCH_SIZE ] [ 3 ] ;
	char nameArray [ FETCH_SIZE ] [ 26 ] ;
   EXEC SQL END DECLARE SECTION;



Semantic error at line 54, column 21, file AttributeCode.pc:
char codeArray [ FETCH_SIZE ] [ 3 ] ;
PCC-S-02322, found undefined identifier

[Updated on: Mon, 24 March 2008 03:56]

Report message to a moderator

Re: Can't compile Pro*C code with 11g [message #308405 is a reply to message #308401] Mon, 24 March 2008 04:03 Go to previous message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
The constant definition must be in the DECLARE section otherwise the precompiler doesn't see it.

Regards
Michel
Previous Topic: Why to use Precompilers....................??
Next Topic: write a pro*C program
Goto Forum:
  


Current Time: Mon Dec 05 14:59:38 CST 2016

Total time taken to generate the page: 0.11552 seconds