【发布时间】:2012-09-17 11:57:47
【问题描述】:
我的问题是 Xerces 和 Windows 都有一个 'DOMDocument' 对象。 Xerces 和我读过的几乎所有内容 here、here 和 here 都建议定义命名空间或取消定义 DOMDocument,它应该看起来像这样。
Void foo(XERCES_CPP_NAMESPACE::DOMDocument* pDocument);
或
#undef DOMDocument
#include <xerces/Stuff>
我想走理智的路线,只应用命名空间,但它似乎不起作用。我真的很犹豫要不要使用#undef,感觉就像是在解决问题。
Windows 文件msxml.h 是抱怨重新定义的文件。
这可能与它们的加载顺序有关吗?我有这样的东西,
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <list>
#include <map>
#include <ctime>
#include "XMLClass.h"
XMLClass.h 包括 xerces 标头。真的很难说是什么导致了这个问题,因为错误出现在微软的标题中。
我还在整个项目中搜索了'DOMDocument',并且在我使用'DOMDocument' 的所有地方都有XERCES_CPP_NAMESPACE 的命名空间。
注意:我使用的是 xerces 3.1 和 VS 2010。
想法?
更新:
我在添加 xerces 标头之前尝试过#undef,但我仍然收到错误消息。所以我真的很困惑为什么这两种解决方案都不适合我。
更新 2:
我也尝试将命名空间从 XERCES_CPP_NAMESPACE::DOMDocument 更改为 xercesc::DOMDocument 但这没有帮助。
【问题讨论】:
标签: c++ namespaces header-files msxml xerces