Pro*C: error PCC-S-02201 while compiling

From: Andrea Laforgia <x_at_x.x>
Date: Wed, 22 Sep 2004 17:43:00 +0200
Message-ID: <cis6i4$5uf$1_at_newsread.albacom.net>



[Quoted] I'm using Oracle9i and trying to compile a .pc file into a .c file. The code is the following:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define SQLCODE sqlca.sqlcode
#define SQLNULL 1403
#define SQLNONE -1405
#define SQLPRES -1
#define SQLOK 0
#define SQLKO 1

EXEC SQL INCLUDE SQLCA; typedef struct {

        char MRN[19];
        int  SEQUENCE;
        int  OFFICIAL_VERSION;

} MYSTRUCT; void myfunc()
{
     EXEC SQL BEGIN DECLARE SECTION;
     MYSTRUCT A;
     EXEC SQL END DECLARE SECTION;

     EXEC SQL SELECT WGTTRS_MRN,
                     WGTTRS_SEQUENCE
              INTO   :A.MRN,
                     :A.SEQUENCE
              FROM WGTTRS
              WHERE WGTTRS_MRN = :A.MRN
              AND WGTTRS_OFFICIAL_VERSIONE = :A.OFFICIAL_VERSION;
}

while compiling it:
D:\Myfolder>proc iname=andrea.pc

I get the following errors:
Pro*C/C++: Release 9.0.1.1.1 - Production on Mer Set 22 17:29:00 2004

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

System default option values taken from: D:\oracle\ora90\precomp\admin\pcscfg.cfg

Error at line 26, column 6 in file andrea.pc:

     MYSTRUCT A;
.....1
PCC-S-02201, Encountered the symbol "MYSTRUCT" when expecting one of the following:

   auto, char, const, double, enum, extern, float, int, long,    ulong_varchar, OCIBFileLocator OCIBlobLocator,    OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,    OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,    short, signed, sql_context, sql_cursor, static, struct,    typedef, union, unsigned, utext, uvarchar, varchar, void,    volatile, a typedef name, a precompiled header, exec oracle,    exec oracle begin, exec, exec sql, exec sql begin,    exec sql end, exec sql type, exec sql var, exec sql include, The symbol "enum," was substituted for "MYSTRUCT" to continue.

Error at line 0, column 0 in file andrea.pc PCC-F-02102, Fatal error while doing C preprocessing

[Quoted] [Quoted] It seems like the precompiler is unable to recognize the type MYSTRUCT that I defined.

I tried to change the code in the following:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define SQLCODE sqlca.sqlcode
#define SQLNULL 1403
#define SQLNONE -1405
#define SQLPRES -1
#define SQLOK 0
#define SQLKO 1

EXEC SQL INCLUDE SQLCA; void myfunc()
{

     EXEC SQL BEGIN DECLARE SECTION;
        char MRN[19];
        int  SEQUENCE;
        int  OFFICIAL_VERSION;
     EXEC SQL END DECLARE SECTION;

     EXEC SQL SELECT WGTTRS_MRN,
                     WGTTRS_SEQUENCE
              INTO   :MRN,
                     :SEQUENCE
              FROM WGTTRS
              WHERE WGTTRS_MRN = :MRN
              AND WGTTRS_OFFICIAL_VERSIONE = :OFFICIAL_VERSION;
}

...and it compiles successfully!...

The former is just a piece of code I made to simplify, I could not post the real code.
How can I solve ?

TIA
Andrea Received on Wed Sep 22 2004 - 17:43:00 CEST

Original text of this message