Ora*C PCC-S-02201,遇到符号“L”当预期出现以下情况之一时:

发布于 2024-12-20 23:03:43 字数 705 浏览 1 评论 0原文

使用 cygwin 配置 pcscfg.cfg 文件在 Windows 中运行 Pro*C 时出现此问题,

Syntax error at line 104, column 31, file C:\cygwin\usr\include\machine/_default_types.h:
Error at line 104, column 31 in file C:\cygwin\usr\include\machine/_default_types.h
#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
..............................1
PCC-S-02201, Encountered the symbol "L" when expecting one of the following:

如下所示:

sys_include=
(C:\cygwin\usr\include,C:\Oracle\product\10.2.0\client_1\precomp\public,C:\cygwin\usr\include\sys,C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include)

ltype=short

define=(ORASTDARG)

code=kr_c 

parse=partial

谢谢!

Having this issue when running Pro*C in windows with cygwin

Syntax error at line 104, column 31, file C:\cygwin\usr\include\machine/_default_types.h:
Error at line 104, column 31 in file C:\cygwin\usr\include\machine/_default_types.h
#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
..............................1
PCC-S-02201, Encountered the symbol "L" when expecting one of the following:

config pcscfg.cfg file looks like this:

sys_include=
(C:\cygwin\usr\include,C:\Oracle\product\10.2.0\client_1\precomp\public,C:\cygwin\usr\include\sys,C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.3\include)

ltype=short

define=(ORASTDARG)

code=kr_c 

parse=partial

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒与心事 2024-12-27 23:03:43

考虑使用

#ifdef ORA_PROC
    #include <apparently_evil_include_file.h>
#endif

来抑制包含邪恶事物的包含,
作为一个可能的解决方法。

它有效地隐藏了 Pro*c 预处理器的包含内容,同时让它存在于编译器中。

您还可以对 metalink 进行一些研究。

Consider using

#ifdef ORA_PROC
    #include <apparently_evil_include_file.h>
#endif

to suppress the include that is including the evil thing,
as a possible workaround.

It effectively hides the include from the Pro*c preprocessor, while letting it be there for the compiler.

You could also do some research on metalink.

听不够的曲调 2024-12-27 23:03:43

警告:猜测如下。

它所抱怨的代码,文件 _default_types.h 中的第 104 行,第 31 列,是:

#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
                              ^ column 31

LLONG_MAX 定义于 <代码>。在 Cygwin 上,定义是:

#define LLONG_MAX __LONG_LONG_MAX__

指的是:

#ifndef __LONG_LONG_MAX__
#define __LONG_LONG_MAX__ 9223372036854775807LL
#endif

类型 long longlong long 整型常量的 LL 后缀是一项新功能在C99中。在 C99 之前的 C 中(除非作为扩展支持),9223372036854775807LL 将是语法错误。我可以想象解析器可能会将其解释为语法上有效的常量 9223372036854775807L 后跟 L。 (这实际上不是一个正确的解释,但无论如何它都是一个语法错误。)

我没有使用过 Ora*C,但我的猜测是它必须解析其输入代码,这是 C 和 SQL 的组合,产生纯C输出。 (这是正确的吗?)如果 Ora*C 解析器不理解类型 long long...LL 文字,它可能会产生这种错误你看到了。

真正引起我怀疑的是 pcscfg.cfg 文件中的这一行:

code=kr_c

这可能告诉 Ora*C 将其输入视为 K&R 风格(即预标准)C 代码。请查阅您的文档,看看是否有一个选项可以让它处理 C99 代码,或者至少是比 K&R C 更现代的代码。

此网页表明code=ansi_c是一个可识别的选项。尝试一下。

或者错误是否来自 Ora*C 调用的 C 编译器?你用什么C编译器?如果不是gcc,可以配置它使用gcc吗?

Warning: Speculation follows.

The code it's complaining about, line 104, column 31 in file _default_types.h, is:

#elif  defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
                              ^ column 31

LLONG_MAX is defined in <limits.h>. On Cygwin, the definition is:

#define LLONG_MAX __LONG_LONG_MAX__

which refers to this:

#ifndef __LONG_LONG_MAX__
#define __LONG_LONG_MAX__ 9223372036854775807LL
#endif

The type long long and the LL suffix for long long integer constants are a new feature in C99. In C prior to C99 (unless it's supported as an extension), 9223372036854775807LL would be a syntax error. I can imagine that a parser might interpret it as the syntactically valid constant 9223372036854775807L followed by L. (That wouldn't actually be a correct interpretation, but it's a syntax error anyway.)

I haven't used Ora*C, but my guess is that it has to parse its input code, which is a combination of C and SQL, producing pure C output. (Is that correct?) If the Ora*C parser doesn't understand the type long long, or a ...LL literal, it could produce the kind of error you're seeing.

Something that really raises my suspicions is this line in your pcscfg.cfg file:

code=kr_c

That probably tells Ora*C to treat its input as K&R style (i.e., pre-standard) C code. Consult your documentation and see if there's an option to tell it to process C99 code, or at least something more modern than K&R C.

This web page suggests that code=ansi_c is a recognized option. Try that.

Or is the error coming from the C compiler that's invoked by Ora*C? What C compiler are you using? If it's not gcc, can you configure it to use gcc?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文