为什么这个头文件没有错误? [英] why this header file has no error?
本文介绍了为什么这个头文件没有错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了一个c ++示例项目。我从示例项目中将头文件复制到我自己的项目中。头文件的内容如下:
#ifndef _SAFEARRAYHELPER_H_
#define _SAFEARRAYHELPER_H_
class CSafeArrayHelper
{
public :
CSafeArrayHelper();
~CSafeArrayHelper();
bool 创建(VARTYPE vt,UINT cDims,UINT lBound,UINT cCount);
bool Destroy();
UINT GetDimension();
bool 附加(LPSAFEARRAY psa);
bool AttachFromVariant(VARIANT * pVariant);
LPSAFEARRAY Detach();
LPSAFEARRAY GetArray();
bool AccessData( void FAR * FAR * pvData);
bool UnaccessData();
bool Lock();
bool Unlock();
bool PutElement( long lIndices, void FAR * vData);
bool GetElement( long lIndices, void FAR * vData);
VARIANT GetAsVariant();
受保护:
LPSAFEARRAY m_pSA;
private :
};
#endif // _SAFEARRAYHELPER_H _
并且有很多这样的错误;
1> g:\ c ++ _ code\driver1 \safearrayhelper.h ( 10 ):错误C2061:语法错误:标识符 VARTYPE
1> g:\ c ++ _ code\driver1 \safearrayhelper.h( 12 ):错误C2146:语法错误:缺少 ;(在标识符 GetDimension的前面)
但是没有示例中的错误。
为什么没有VARTYPELPSAFEARRAY的定义,但是exampl项目中没有错误。
-kkklko
解决方案
因为(可能)在示例项目中来源_SAFEARRAYHELPER_H _
标题包含以下包含VARTYPE
和LPSAFEARRAY
I get a piece of c++ example project. I copy a header file into myself project from the example project.the content of the header file is below:
#ifndef _SAFEARRAYHELPER_H_
#define _SAFEARRAYHELPER_H_
class CSafeArrayHelper
{
public:
CSafeArrayHelper();
~CSafeArrayHelper();
bool Create(VARTYPE vt, UINT cDims, UINT lBound, UINT cCount);
bool Destroy();
UINT GetDimension();
bool Attach(LPSAFEARRAY psa);
bool AttachFromVariant(VARIANT* pVariant);
LPSAFEARRAY Detach();
LPSAFEARRAY GetArray();
bool AccessData(void FAR* FAR* pvData);
bool UnaccessData();
bool Lock();
bool Unlock();
bool PutElement(long lIndices, void FAR* vData);
bool GetElement(long lIndices, void FAR* vData);
VARIANT GetAsVariant();
protected:
LPSAFEARRAY m_pSA;
private:
};
#endif // _SAFEARRAYHELPER_H_
and there are many error like that;
1>g:\c++_code\driver1\safearrayhelper.h(10): error C2061: 语法错误: 标识符"VARTYPE"
1>g:\c++_code\driver1\safearrayhelper.h(12): error C2146: 语法错误: 缺少";"(在标识符"GetDimension"的前面)
But there is no error in the example.
why there are no definion of "VARTYPE" "LPSAFEARRAY",but there is no error in the exampl project.
-kkklko
解决方案
Because (probably) in the example project sources the_SAFEARRAYHELPER_H_
header is included below the ones containing the definitions ofVARTYPE
andLPSAFEARRAY
.
这篇关于为什么这个头文件没有错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文