包含文件中的 EXEC SQL 语句上的 Oracle Pro*C 预编译器错误
我正在将一些遗留代码转换为 Oracle Pro*C。我在使用 Oracle 11.2 的 Linux 机器上。我们使用“.cp”作为 Pro*C 源文件的后缀。我不是一个 C 开发人员,所以我在工作中有点摸索。
在某一时刻,我在共享库文件“assign_field.cp”中有一些代码,所以在 myprog.cp 中我正在做
EXEC SQL INCLUDE "assign_field.cp";
现在,在 allocate_field.cp 中,我有一行非常常见的 Pro*C 代码...
EXEC SQL INCLUDE SQLCA;
为此行,以及许多其他,我看到以下编译器输出:
assign_field.cp:35: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âSQLâ
看起来编译器没有识别出这是 Pro*C 代码。
我还有其他包含文件,它们看起来与 allocate_field.cp 非常相似,但在包含时似乎编译得很好。
I'm converting some legacy code to Oracle Pro*C. I'm on a Linux box using Oracle 11.2. We are using ".cp" as the suffix for Pro*C source files. I'm not much of a C developer so I am sort of banging around in the dark as I go.
At one point I have some code in a shared library file, "assign_field.cp," so in myprog.cp I am doing
EXEC SQL INCLUDE "assign_field.cp";
Now, in assign_field.cp, I have a very common line of Pro*C code...
EXEC SQL INCLUDE SQLCA;
For this line, along with many others, I am seeing the following compiler output:
assign_field.cp:35: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âSQLâ
It looks as though the compiler isn't recognizing that this is Pro*C code.
I've got other include files that look very similar to assign_field.cp but which appear to compile just fine when included.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要在程序流程中包含 C 文件(在本例中为 .cp 文件)。分别编译它们;仅引用函数的声明,例如包含的 .h 文件中的声明。在 makefile 中调用链接器时引用已编译的目标文件(可能是 .o)。
Don't include the C files (in this case, .cp files) in the program's flow. Compile them separately; refer only to the function's declaration, such as in an included .h file. Refer to the compiled object files (probably .o) in the call to the linker in the makefile.