我下载了一个聊天室程序
底层 用XML格式来传输文件  
怎么编译不过去  好像要设置msxml,  怎么设置呀  
还有是不是要装Internet Development DDk   
编译错误信息是好多类似error C2872: “IXMLDOMDocumentPtr” : 不明确的符号 我下载了一个xmlsdk   装上以后还是这样  是不是在VC工程里面也要设置?请大家指教  谢谢

解决方案 »

  1.   

    在头文件里加#import "msxml3.dll" 
    using namespace MSXML2;
      

  2.   

    还是不行 我
    #import "msxml3.dll" 
    using namespace MSXML2;#import "msxml.dll" 
    using namespace MSXML;
    都包含了
      

  3.   

    去掉第二个试试msxml.dll太古老了
      

  4.   

    给你段代码,拿去试一下
    // xml.cpp : Defines the entry point for the console application.
    //#include "stdafx.h"
    #include "resource.h"#if !defined(__MSXML3__)#define __MSXML3__#import "msxml3.dll" 
    using namespace MSXML2;
    #endif#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    int nRetCode = 0;
    ::CoInitialize(NULL);
    // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
    // TODO: change error code to suit your needs
    cerr << _T("Fatal Error: MFC initialization failed") << endl;
    nRetCode = 1;
    }
    else
    {
    // TODO: code your application's behavior here.

    IXMLDOMDocument2Ptr xml;
    xml.CreateInstance(__uuidof(MSXML2::DOMDocument));
    xml->load("xxxx.xml"); int i= 1;
    BOOL bNode = TRUE;
    while (bNode)
    { IXMLDOMNodePtr node;
    CString strRoot; strRoot.Format("/InOutStore/OutStore[%d]", i++);
    node=xml->selectSingleNode(_bstr_t(strRoot));
    if (node)
    {
    IXMLDOMNodePtr nodeCode, nodeTime;
    VARIANT value;
    CString strCode = strRoot + "/code";
    nodeCode=xml->selectSingleNode(_bstr_t(strCode));
    nodeCode->get_nodeTypedValue(&value); CString str1(value.bstrVal);
    SysFreeString(value.bstrVal);
    CString strTime = strRoot + "/time";
    nodeTime=xml->selectSingleNode(_bstr_t(strTime ));
    nodeTime->get_nodeTypedValue(&value); CString str2(value.bstrVal);
    SysFreeString(value.bstrVal);
    printf("\n%s\t%s", str1, str2);
    }
    else
    bNode = FALSE;
    } } ::CoUninitialize();
    return nRetCode;
    }