关于xmllite的问题,恳请高手解答一下!

walk3976 2011-10-25 05:50:41
我在一个DLL中调用了xmllite,编译的时候会报xmllite.h文件错误如下:

error C2146: syntax error : missing ';' before identifier 'IXmlReader'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ';' before identifier 'IXmlReader'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2086: 'int IXmlReader' : redefinition
.h(49) : see declaration of 'IXmlReader'
error C2146: syntax error : missing ';' before identifier 'IXmlResolver'
warning C4091: '' : ignored on left of 'interface' when no variable is declared
error C2146: syntax error : missing ';' before identifier 'IXmlWriter'
warning C4091: '' : ignored on left of 'interface' when no variable is declared
error C2371: 'IXmlResolver' : redefinition; different basic types
.h(55) : see declaration of 'IXmlResolver'
: error C2371: 'IXmlWriter' : redefinition; different basic types
.h(61) : see declaration of 'IXmlWriter'
error C2061: syntax error : identifier 'IXmlReader'
error C2061: syntax error : identifier 'IXmlReader'
: error C2061: syntax error : identifier 'IXmlReader'


而我在普通的win32控制台程序中可以正常加载xmllite.lib xmllite.h等
是不是xmllite不支持DLL啊
看了半天 xmllite.h头上写了写编译配置的东西,也不知道是不是跟这个有关,请高手解答一下,多谢
/* this ALWAYS GENERATED file contains the definitions for the interfaces */


/* File created by MIDL compiler version 7.00.0499 */
/* Compiler settings for xmllite.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )

#pragma warning( disable: 4049 ) /* more than 64k source lines */


/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif

#include "rpc.h"
#include "rpcndr.h"

#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__


#ifndef __xmllite_h__
#define __xmllite_h__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

/* Forward Declarations */

#ifndef __IXmlReader_FWD_DEFINED__
#define __IXmlReader_FWD_DEFINED__
typedef interface IXmlReader IXmlReader;
#endif /* __IXmlReader_FWD_DEFINED__ */


#ifndef __IXmlResolver_FWD_DEFINED__
#define __IXmlResolver_FWD_DEFINED__
typedef interface IXmlResolver IXmlResolver;
#endif /* __IXmlResolver_FWD_DEFINED__ */


#ifndef __IXmlWriter_FWD_DEFINED__
#define __IXmlWriter_FWD_DEFINED__
typedef interface IXmlWriter IXmlWriter;
#endif /* __IXmlWriter_FWD_DEFINED__ */

...全文
162 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sssnowman 2011-11-04
  • 打赏
  • 举报
回复
这个头文件怎么是MIDL编译器产生的,xmllite是个COM组件形式提供的吗?不好意思,我没用过这个东西
acaiacc 2011-10-31
  • 打赏
  • 举报
回复
error C2086: 'int IXmlReader' : redefinition
检查一下哪里有重复定义的地方

或者xmllite的头文件里面放了一些实现的东东,然后你的编译选项,有跟调用的lib不一致
walk3976 2011-10-26
  • 打赏
  • 举报
回复

#if defined(__cplusplus) && !defined(CINTERFACE)

MIDL_INTERFACE("7279FC81-709D-4095-B63D-69FE4B0D9030")
IXmlReader : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SetInput(
/* */
__in_opt IUnknown *pInput) = 0;

virtual HRESULT STDMETHODCALLTYPE GetProperty(
/* */
__in UINT nProperty,
/* */
__out LONG_PTR *ppValue) = 0;

virtual HRESULT STDMETHODCALLTYPE SetProperty(
/* */
__in UINT nProperty,
/* */
__in_opt LONG_PTR pValue) = 0;

virtual HRESULT STDMETHODCALLTYPE Read(
/* */
__out_opt XmlNodeType *pNodeType) = 0;

virtual HRESULT STDMETHODCALLTYPE GetNodeType(
/* */
__out XmlNodeType *pNodeType) = 0;


这些都是定义过的,而且我是在VS2005下调用的,在写win32控制台的时候可以成功调用,但是在DLL工程里面调用的话就会出现上面的问题,不知道是不是不支持二次封装
fishion 2011-10-25
  • 打赏
  • 举报
回复
缺少了IXmlReade等的定义吧。
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

这个应该是你的代码是V6.0的移植到高板本的VS上去了,把没有定义函数类型的地方定义为void

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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