Pro*C Compiler errors on C Code. [message #443950] |
Thu, 18 February 2010 02:28 |
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 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
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 |
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 #450992 is a reply to message #443950] |
Mon, 12 April 2010 01:01 |
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 |
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 #451076 is a reply to message #443950] |
Mon, 12 April 2010 05:45 |
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.
|
|
|
|