菜鸟提问:救命啊!关于c++下数据库编程的小问题,请大虾回答,高分相送,在线等待

lihhll 2004-03-05 02:13:33
我在window下,用C++编程,在工程中加入数据库类文件:

database.h 文件:


#ifndef DATABASE_H
#define DATABASE_H

#include <sql.h>
#include <sqlext.h>
#include <Sqltypes.h>
#include <odbcinst.h>
#include <Odbcss.h>
#include <stdio.h>
#include <stdlib.h>
class DataBase
{
DataBase(int a);
~DataBase(void);
};

#endif



database.cpp文件:


#include "stdafx.h"
#include <stdio.h>
#include "database.h"
DataBase::DataBase(int a)
{

}

DataBase::~DataBase(void)
{

}



在编译时,为什么加上头文件
#include <sql.h>
#include <sqlext.h>
#include <Sqltypes.h>
#include <odbcinst.h>
#include <Odbcss.h>
时,就出如下错误:
Compiling...
database.cpp
d:\microsoft visual studio\vc98\include\sqltypes.h(114) : error C2146: syntax error : missing ';' before identifier 'SQLHWND'
d:\microsoft visual studio\vc98\include\sqltypes.h(114) : fatal error C1004: unexpected end of file found
Generating Code...
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\database.sbr': No such file or directory
Error executing bscmake.exe.


而我去掉头文件
#include <sql.h>
#include <sqlext.h>
#include <Sqltypes.h>
#include <odbcinst.h>
#include <Odbcss.h>
则编译顺利通过。

请问各位大虾,原因是什么?


在线等待,及时给分
...全文
35 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复

64,651

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧