#ifndef _ORDBM_IMPL_H_
#define _ORDBM_IMPL_H_
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
#include <odbcss.h>
class ordbm_impl : public POA_ORDBM::PermanentLayer
{
........................
};
#endif
编译出现下列一大堆的错误
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqltypes.h(137) : error C2146: syntax error : missing ';' before identifier 'SQLHWND'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqltypes.h(137) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(1682) : error C2061: syntax error : identifier 'SQLHWND'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2013) : error C2065: 'LPWSTR' : undeclared identifier
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2013) : error C2065: 'DWORD' : undeclared identifier
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2013) : warning C4229: anachronism used : modifiers on data are ignored
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2013) : error C2078: too many initializers
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2015) : error C2143: syntax error : missing ';' before '__stdcall'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2015) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2015) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2016) : error C2143: syntax error : missing ';' before '__stdcall'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2016) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2016) : error C2371: 'DWORD' : redefinition; different basic types
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2016) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2023) : warning C4229: anachronism used : modifiers on data are ignored
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : error C2143: syntax error : missing ';' before '__stdcall'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : error C2146: syntax error : missing ')' before identifier 'dwValue'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : warning C4229: anachronism used : modifiers on data are ignored
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2033) : error C2059: syntax error : ')'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2034) : error C2143: syntax error : missing ';' before '__stdcall'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2034) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2034) : error C2371: 'DWORD' : redefinition; different basic types
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2034) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2044) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2044) : error C2143: syntax error : missing ';' before '*'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2044) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2045) : error C2146: syntax error : missing ';' before identifier 'dwFlags'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2045) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2045) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2047) : error C2143: syntax error : missing ';' before '*'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2047) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2047) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2048) : error C2143: syntax error : missing ';' before '*'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2048) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2048) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2051) : error C2143: syntax error : missing ';' before '*'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2051) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2051) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2052) : error C2143: syntax error : missing ';' before '*'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2052) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2052) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2056) : error C2143: syntax error : missing ';' before '__stdcall'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2056) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2056) : error C2086: 'int VOID' : redefinition
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2015) : see declaration of 'VOID'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlext.h(2056) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlucode.h(280) : error C2061: syntax error : identifier 'SQLHWND'
c:/program files/microsoft visual studio 8/vc/platformsdk/include/sqlucode.h(647) : error C2061: syntax error : identifier 'SQLHWND'
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
定位错误后将转到sqlext.h文件中的HENV定义的地方。开始时我也很奇怪到底是怎么回事,因为语法一点错误没有,头文件也已经包含进去了,怎么还说没有定义HENV类型呢?后来招了一个前辈请教,他也没搞定,真真百思不得其解!
后来知道了原因如下:
在引用sqlext.h或sql.h文件之前必须引用windows.h ;因为sql.h中引用了windows.h的一些定义
#include <windows.h>
#include "sqlext.h"