I am developing a DEBUG message printing function in my Pro*C code. I am getting error on following line:
我正在我的Pro * C代码中开发一个DEBUG消息打印功能。我在下面的行中收到错误:
fmt = va_arg(args, char *);
The error is as follow:
错误如下:
Syntax error at line 672, column 40, file commonutil_x.pc:
Error at line 672, column 40 in file commonutil_x.pc
fmt = va_arg(args, char * );
.......................................1
PCC-S-02201, Encountered the symbol ")" when expecting one of the following:
( * & + - ~ ! ^ ++ -- ... sizeof, an identifier,
a quoted string, a numeric constant,
The symbol "..." was substituted for ")" to continue.
My machine os informations are as following:
我的机器os信息如下:
Linux Babo 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux
But I wrote the same code in a small C program it get compiled and worked. Can any one let me know why it is not working in Pro*C? Also compiled my larger Pro*C program on a x86_64 linux machine, it get compiled without any errors. Here are the full information about second machine:
但是我在一个小的C程序中编写了相同的代码,它被编译和工作。任何人都可以告诉我为什么它不能用于Pro * C吗?还在x86_64 linux机器上编译了我的大型Pro * C程序,它编译时没有任何错误。以下是有关第二台机器的完整信息:
Linux Habo 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
Please help me why it is working on x86_64 and not working on i386 ?
请帮助我为什么它在x86_64上工作而不在i386上工作?
1 个解决方案
#1
0
Given that you've confused the 32-bit Pro*C precompiler but not the 64-bit version, you have probably hit a bug in the Pro*C precompiler.
鉴于您已经混淆了32位Pro * C预编译器而不是64位版本,您可能已经遇到了Pro * C预编译器中的错误。
Recommendation: move the logging function that gives an error into a separate, pure C source file, and compile that without the Pro*C compiler.
建议:将提供错误的日志记录功能移动到单独的纯C源文件中,并在没有Pro * C编译器的情况下进行编译。
Another option, given the nature of the error messages, is to replace the char *
with a plain type name. It is fairly clear that the Pro*C precompiler is expecting that *
to be a multiplication symbol rather than part of a type name.
考虑到错误消息的性质,另一个选择是用普通类型名称替换char *。很明显,Pro * C预编译器期望*是乘法符号而不是类型名称的一部分。
typedef char *charptr;
fmt = va_arg(args, charptr);
This is not as good as separating the compilation, in my view.
在我看来,这不如分离编译那么好。
I'm not sure whether it is feasible (and it very probably is not sensible), but you could consider running the C preprocessor over the source before submitting it to the Pro*C precompiler. Not recommended, but it might resolve the problem.
我不确定它是否可行(并且很可能是不合理的),但您可以考虑在将源代码处理器提交给Pro * C预编译器之前在源上运行C预处理器。不推荐,但它可能会解决问题。
#1
0
Given that you've confused the 32-bit Pro*C precompiler but not the 64-bit version, you have probably hit a bug in the Pro*C precompiler.
鉴于您已经混淆了32位Pro * C预编译器而不是64位版本,您可能已经遇到了Pro * C预编译器中的错误。
Recommendation: move the logging function that gives an error into a separate, pure C source file, and compile that without the Pro*C compiler.
建议:将提供错误的日志记录功能移动到单独的纯C源文件中,并在没有Pro * C编译器的情况下进行编译。
Another option, given the nature of the error messages, is to replace the char *
with a plain type name. It is fairly clear that the Pro*C precompiler is expecting that *
to be a multiplication symbol rather than part of a type name.
考虑到错误消息的性质,另一个选择是用普通类型名称替换char *。很明显,Pro * C预编译器期望*是乘法符号而不是类型名称的一部分。
typedef char *charptr;
fmt = va_arg(args, charptr);
This is not as good as separating the compilation, in my view.
在我看来,这不如分离编译那么好。
I'm not sure whether it is feasible (and it very probably is not sensible), but you could consider running the C preprocessor over the source before submitting it to the Pro*C precompiler. Not recommended, but it might resolve the problem.
我不确定它是否可行(并且很可能是不合理的),但您可以考虑在将源代码处理器提交给Pro * C预编译器之前在源上运行C预处理器。不推荐,但它可能会解决问题。