一个很简单的pro*C程序!!!急
写了一个pro*C小程序,就是连接oracle数据库,预编译通过了(我使用了parse=none开关项),编译生成的.c文件时,出错了。???
程序如下:
- #include <stdio.h>;
- #include <string.h>;
- #include <stdlib.h>;
- #include <sqlca.h>;
- void sqlerror()
- {
- printf("the data base error");
- EXEC SQL ROLLBACK WORK RELEASE;
- }
- void main()
- {
- EXEC SQL BEGIN DECLARE SECTION;
- char user[50];
- char pass[50];
- EXEC SQL END DECLARE SECTION;
- strcpy(user,"lucky");
- strcpy(pass,"lucky");
- EXEC SQL WHENEVER SQLERROR DO sqlerror();
- EXEC SQL CONNECT :user IDENTIFIED BY :pass;
- printf("connect already!:)");
- EXEC SQL ROLLBACK WORK RELEASE;
- }
复制代码
错误如下:
- test.c:117: warning: type defaults to `int' in declaration of `sqlcxt'
- test.c:119: warning: type defaults to `int' in declaration of `sqlcx2t'
- test.c:121: warning: type defaults to `int' in declaration of `sqlbuft'
- test.c:122: warning: type defaults to `int' in declaration of `sqlgs2t'
- test.c:123: warning: type defaults to `int' in declaration of `sqlorat'
- test.c:172: warning: return type of `main' is not `int'
- test.c:114: warning: `sqlstm' defined but not used
- test.c:126: warning: `IAPSUCC' defined but not used
- test.c:127: warning: `IAPFAIL' defined but not used
- test.c:128: warning: `IAPFTL' defined but not used
- /tmp/ccGpDBvk.o(.text+0x65): In function `sqlerror':
- /opt/oracle/oui/test.c:162: undefined reference to `sqlca'
- /tmp/ccGpDBvk.o(.text+0x123): In function `main':
- /opt/oracle/oui/test.c:195: undefined reference to `sqlca'
- /tmp/ccGpDBvk.o(.text+0x2bb):/opt/oracle/oui/test.c:229: undefined reference to `sqlca'
- /tmp/ccGpDBvk.o(.text+0x323):/opt/oracle/oui/test.c:246: undefined reference to `sqlca'
- /tmp/ccGpDBvk.o(.text+0x357):/opt/oracle/oui/test.c:250: undefined reference to `sqlca'
- collect2: ld returned 1 exit status
复制代码
不知道为什么?
而且,我预编译时将parse去掉,就会有一大堆的错,好像是有关头文件(比如stdio,string等)的。我看了一些帖子,要装compat-egcs等安装包,但是,好像这些只是在redhat7。*的包,我的是redhat 9.0,安装盘里没有这些包,下载后,又不适合安装在9。0上,怎么办?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
顶一下