菜鸟提问:救命啊!关于c++下数据库编程的小问题,请大虾回答,高分相送,在线等待
我在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>
则编译顺利通过。
请问各位大虾,原因是什么?
在线等待,及时给分