免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5585 | 回复: 3
打印 上一主题 下一主题

[C++] 求助,C++通过OTL连接ORLCAL的程序编译失败。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-14 09:17 |只看该作者 |倒序浏览
这两天公司作程序,需要连接数据库。我按照网上的范例,通过OTL连接数据库,但是编译无法通过。请大家帮忙看看是什么原因。
#include <iostream>
#include <string>
#include <stdio.h>
#define OTL_ODBC_UNIX
#include "otlv4.h" //



//class otl_connect;

using namespace std;
otl_connect db;

int main( void )
{
    otl_connect::otl_initialize();
    return 0;
}


根据网上的说法,#define OTL_ODBC_UNIX要放在#include "otlv4.h" 前,但是编译的时候报下面的错误:

[table=95%][tr][td][font=FixedSys]otlv4.h:9511:17: error: sql.h: No such file or directory
otlv4.h:9512:20: error: sqlext.h: No such file or directory
In file included from main.cpp:5:
otlv4.h:9698: error: 'TIMESTAMP_STRUCT' does not name a type
otlv4.h:10118: error: 'HENV' does not name a type
otlv4.h:10119: error: 'HDBC' does not name a type
otlv4.h:10138: error: ISO C++ forbids declaration of 'HENV' with no type
otlv4.h:10138: error: expected ';' before '&' token
otlv4.h:10139: error: expected `;' before 'HDBC'
otlv4.h:10139: error: ISO C++ forbids declaration of '
HDBC' with no type
otlv4.h:10139: error: expected '
;' before '&' token
otlv4.h:10141: error: expected `;'
before 'int'
otlv4.h:10256: error: 'HENV' has not been declared
otlv4.h:10257: error: 'HDBC' has not been declared
otlv4.h: In constructor 'otl_conntl_conn()':
....................
[/font][/td][/tr][/table]



otlv4.h:9511:17: error: sql.h: No such file or directory
otlv4.h:9512:20: error: sqlext.h: No such file or directory
这两行说找不到sql.h,sqlext.h这两个文件,但是我看网上的范例里面没有说要包含这两个头文件。

系统环境:
系统:HP11
编译器: HPgcc
otl头文件:从网上单独下载的
数据库:oracle 10G

请大家帮忙

[ 本帖最后由 封神 于 2009-8-14 09:18 编辑 ]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2009-08-15 00:28 |只看该作者
楼主我怎么没看到你定义和oracle有关的宏?
你再仔细看看那个网站的例子。
sql.h,sqlext.h可能是oracle带的头文件。
貌似需要安装oracle客户端才会有这些。
几年前弄过,很久都忘了。

论坛徽章:
0
3 [报告]
发表于 2009-08-15 00:43 |只看该作者
OTL
范例不是饭粒,不给你喂饭,要自己安装需要的库和头文件。LS 的提示可以看下。

论坛徽章:
0
4 [报告]
发表于 2009-08-15 02:50 |只看该作者
得到答案好好学习一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP