Home » Developer & Programmer » Precompilers, OCI & OCCI » Pro*C Compiler errors on C Code. (10g2, Solaris 10, gcc)
Pro*C Compiler errors on C Code. [message #443950] Thu, 18 February 2010 02:28 Go to next message
mjm22
Messages: 54
Registered: January 2010
Location: Singapore
Member
I have a macro and function that employ variable arguments. First I coded a test in order to prove it worked.... which it more or less does (though needs to be improved... I don't like the last printf("\n").

#include <stdio.h>
#include <stdarg.h>
#include <string.h>

#define toLog(x, optArgs...) \
    (void)writeLog(__FILE__ , __LINE__ , "INFORM" , x , ##optArgs)

void writeLog (char  *pFile,
               int   iLine,
               char  *pMsgType,
               char  *pFormat , ...)
{
    va_list args;

    va_start(args, pFormat);
    printf("LOG: %s: %s:(%i): ",pMsgType,pFile,iLine);
    vprintf(pFormat, args);
    printf("\n");

    va_end(args);
}


int main() 
{
    int one=1;
    int five=5;

  toLog("main: in");
  toLog("Values are %i:%i", one, five);
  toLog("main: out");
  return 0;
}


This compiles ok and runs fine. So I put the code into my main program. In here I have some Pro*C source for some database lookup. When the Pro*C pre-compiler hits the new code it fails with the following message..

Pro*C/C++: Release 10.2.0.4.0 - Production on Thu Feb 18 14:50:26 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

System default option values taken from: /opt/oracle/product/10.2.0/client_1/precomp/admin/pcscfg.cfg

Syntax error at line 66, column 31, file GRD.h:
Error at line 66, column 31 in file GRD.h
#definetoLog(x, optArgs...) \
..............................1
PCC-S-02014, Encountered the symbol "..." when expecting one of the following:


Is there a way of getting the Pro*C Compiler to ignore this?

Regards

Mike
Re: Pro*C Compiler errors on C Code. [message #443960 is a reply to message #443950] Thu, 18 February 2010 02:50 Go to previous messageGo to next message
Michel Cadot
Messages: 63801
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is your option of "code" parameter in pcc command?
Be sure it is not set to "kr_c" (maybe set in your configuration file). I'm not sure if one of the other values ("ansi_c" and "cpp") allows this but if it works on test you can find the correct value.

Regards
Michel

[Updated on: Thu, 18 February 2010 02:51]

Report message to a moderator

Re: Pro*C Compiler errors on C Code. [message #444001 is a reply to message #443960] Thu, 18 February 2010 05:49 Go to previous messageGo to next message
mjm22
Messages: 54
Registered: January 2010
Location: Singapore
Member
I don't set it in the MakeFile.. i only set the following..

PROC=proc
SQLCHECK=FULL
ERRORS=YES
IRECLEN=20000

${PROC} USERID=${DATABASE} INAME=$< ONAME=$@ SQLCHECK=${SQLCHECK} ERRORS=${ERRORS} IRECLEN=${IRECLEN}


checking the cofig..
-bash-3.00$ proc code=?

Pro*C/C++: Release 10.2.0.4.0 - Production on Thu Feb 18 19:27:29 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

System default option values taken from: /opt/oracle/product/10.2.0/client_1/precomp/admin/pcscfg.cfg

Option name   :  code=string
Current value :  kr_c
Restrictions  :  ansi_c, cpp, kr_c
Description   :  The type of code to be generated


So, yes it is set to kr_c. I have set a CODE=ANSI_C option and included it in the proc call. UNIX down just now but will test tomorrow. Thanks for you help.



Re: Pro*C Compiler errors on C Code. [message #444135 is a reply to message #443950] Thu, 18 February 2010 16:09 Go to previous messageGo to next message
vicenzo
Messages: 28
Registered: December 2007
Location: Paris
Junior Member
PRO*C is not fully C99 compliant and does not recognize variadic macros.

[Updated on: Thu, 18 February 2010 16:09]

Report message to a moderator

Re: Pro*C Compiler errors on C Code. [message #444142 is a reply to message #443950] Thu, 18 February 2010 20:19 Go to previous messageGo to next message
mjm22
Messages: 54
Registered: January 2010
Location: Singapore
Member
Yeah, I tried again today with the CODE=ANSI_C set but still have the same problem.

Hmm, have to think of something else.

Mike
Re: Pro*C Compiler errors on C Code. [message #450992 is a reply to message #443950] Mon, 12 April 2010 01:01 Go to previous messageGo to next message
csprog
Messages: 10
Registered: March 2010
Location: Chennai
Junior Member
Hi mike,

while precompiling .pc program am getting an error,

System default option values taken from: D:\oracle\product\9.2.0.1\client_1\precomp\admin\pcscfg.cfg
PCC-F-02104, Unable to connect to Oracle

could you please tell me what are the options we need to enter into the file pcscfg.cfg.

In my system pcscfg.cfg is only having one line as follows.

define=(WIN32_LEAN_AND_MEAN)

Thanks in advance.

Re: Pro*C Compiler errors on C Code. [message #451038 is a reply to message #450992] Mon, 12 April 2010 04:18 Go to previous messageGo to next message
mjm22
Messages: 54
Registered: January 2010
Location: Singapore
Member

Hi,

Sounds like a network error to me.. some problem anyway that means that you cannot connect to the database... more below..

I didn't configure anything else in my pcscfg.cfg file so it looks like the following (the same as before I started my development).....

-bash-3.00$ cat pcscfg.cfg
sys_include=(/usr/include)
ltype=short


Instead I set the flags I need in my makefile (the ProC ones are as follows)...
#Pro C Flags
PROC=proc
SQLCHECK=FULL
ERRORS=YES
IRECLEN=20000
CODE=ANSI_C

The the line I use to call the ProC precompiler is..
# rules to process ProC source files
${PROC} USERID=${DATABASE} INAME=$< ONAME=$@ SQLCHECK=${SQLCHECK} CODE=${CODE} ERRORS=${ERRORS} IRECLEN=${IRECLEN}


I think for your problem you need to check your USERID flag... In the above mine is set to username/password@database. Essentially I think this is what is failing and giving you your error message.

Mike


Re: Pro*C Compiler errors on C Code. [message #451049 is a reply to message #450992] Mon, 12 April 2010 04:43 Go to previous messageGo to next message
Michel Cadot
Messages: 63801
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
DO NOT repeat the same question in several topic.
DO NOT hijack others topic with your specific question.

BUT DO read the documentation and links you have be pointed.
It is clearly explained in it, don't be so lazy.

Regards
Michel
Re: Pro*C Compiler errors on C Code. [message #451057 is a reply to message #451049] Mon, 12 April 2010 04:49 Go to previous messageGo to next message
mjm22
Messages: 54
Registered: January 2010
Location: Singapore
Member
?? Michael was that to me? I was just trying to answer the guys question??
Re: Pro*C Compiler errors on C Code. [message #451072 is a reply to message #451057] Mon, 12 April 2010 05:21 Go to previous messageGo to next message
Michel Cadot
Messages: 63801
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No it was to csprog (see the message number I answered) who has already asked this question in a topic he created and got an answer in it.
http://www.orafaq.com/forum/mv/msg/156559/450342/102589/#msg_450342

Regards
Michel

[Updated on: Mon, 12 April 2010 05:22]

Report message to a moderator

Re: Pro*C Compiler errors on C Code. [message #451076 is a reply to message #443950] Mon, 12 April 2010 05:45 Go to previous messageGo to next message
csprog
Messages: 10
Registered: March 2010
Location: Chennai
Junior Member
Michel,

when i went through the forums, i found this one and mike seemed to have succeeded in converting .pc to .c. so only i asked him what are all the options he had in his configuration file.

After then only, i posted the same question in my post which have been answered by you now.

after i got the reply from you in my post, i just read the document and working on it. Am not lazy either. Deadline is near, so only i asked mike.

And also, i was not intentional to hijack others post.

Hope you could understand.

Anyway, Sorry and Thanks.
Re: Pro*C Compiler errors on C Code. [message #451078 is a reply to message #451038] Mon, 12 April 2010 05:55 Go to previous message
csprog
Messages: 10
Registered: March 2010
Location: Chennai
Junior Member
dear mike,

Thank you a lot for tht TIMELY help.
Previous Topic: PROC compilation
Next Topic: Oracle Connection not getting closed
Goto Forum:
  


Current Time: Sun Sep 25 07:49:59 CDT 2016

Total time taken to generate the page: 0.06435 seconds