LNK2019 外部符号 public: bool __thiscall …不解析

LNK2019 símbolo externo public: bool __thiscall … sin resolver

我正在尝试为我的项目编译一个工具。到目前为止我已经解决了所有问题,但是我找不到解决这个问题的方法。

如果有人能帮助我,我将不胜感激,谢谢。

NtlScriptEncrypter.cpp

#include "StdAfx.h"
#include "NtlScriptEncrypter.h"
#include "NtlXMLDoc.h"
#include "NtlFileSerializer.h"

#define CRYPT_PASSWORD "!@*&(agebreak"

CNtlScriptEncrypter::CNtlScriptEncrypter(void)
{
}

CNtlScriptEncrypter::~CNtlScriptEncrypter(void)
{
}

/**
 * ÄÁÇÇ±× ¼³Á¤ ÆÄÀÏÀ» ·ÎµåÇÑ´Ù. È®ÀåÀÚ·Î XML,EDF¸¦ ±¸º°ÇÑ´Ù.
 * \param pConfigData ·ÎµåÇÑ µ¥ÀÌÅ͸¦ ÀúÀåÇÒ Æ÷ÀÎÅÍ
 * \param szFileName ·ÎµåÇÒ ÆÄÀÏ À̸§
 * \return 
 */
BOOL CNtlScriptEncrypter::LoadConfigOption( OUT SConfigData* pConfigData, char* szFileName ) 
{
    if(!pConfigData || !szFileName)
        return FALSE;

    char szDrive[128]   = {0,};
    char szdir[128]     = {0,};
    char szfName[128]   = {0,};
    char szExt[128]     = {0,};
    _splitpath_s(szFileName, szDrive, szdir, szfName, szExt);    
    _strlwr_s(szExt);
    
    if(strcmp(szExt, ".xml") == 0)
    {
        return LoadConfigOptionXML(pConfigData, szFileName);
    }
    else if(strcmp(szExt, ".edf") == 0)
    {
        return LoadConfigOptionENC(pConfigData, szFileName);
    }

    return FALSE;
}

BOOL CNtlScriptEncrypter::LoadConfigOptionXML( OUT SConfigData* pConfigData, char* szFileName ) 
{
    CNtlXMLDoc doc;
    doc.Create();

    // xml doc load
    if(doc.Load( (char*)szFileName ) == false)
    {
        return FALSE;
    }

    char chBuffer[1024];

    // config operationÀ» ¾ò¾î¿Â´Ù.
    IXMLDOMNode* pNode = doc.SelectSingleNode((char*)"/config_options/op");

    if(!doc.GetTextWithAttributeName(pNode, "ver", chBuffer, 1024))
    {
        return FALSE;
    }

    if(!doc.GetTextWithAttributeName(pNode, "ip", chBuffer, 1024))
    {
        return FALSE;
    }

    pConfigData->strAddr = chBuffer;

    if(!doc.GetTextWithAttributeName(pNode, "port", chBuffer, 1024))
    {
        return FALSE;
    }

    pConfigData->dwPort = (DWORD)atoi(chBuffer);

    pNode->Release(); 

    // config localÀ» ¾ò¾î¿Â´Ù.

    pNode = doc.SelectSingleNode((char*)"/config_options/local");

    if(!doc.GetTextWithAttributeName(pNode, "ver", chBuffer, 1024))
    {
        return FALSE;
    }

    if(!doc.GetTextWithAttributeName(pNode, "local_dsp", chBuffer, 1024))
    {
        return FALSE;
    }

    pConfigData->strLocalDsp = chBuffer;

    if(!doc.GetTextWithAttributeName(pNode, "local_sync_dsp", chBuffer, 1024))
    {
        return FALSE;
    }

    pConfigData->strLocalSyncDsp = chBuffer;

    // Bug Trap
    pNode = doc.SelectSingleNode("/config_options/BUGTRAP");
    if(doc.GetTextWithAttributeName(pNode, "ip", chBuffer, 1024))
    {
        pConfigData->strBugTrapServerIP = chBuffer;
    }

    if(doc.GetTextWithAttributeName(pNode, "port", chBuffer, 1024))
    {
        pConfigData->dwBugTrapServerPort = atoi(chBuffer);        
    }

    pNode->Release(); 

    return TRUE;
}

BOOL CNtlScriptEncrypter::LoadConfigOptionENC( OUT SConfigData* pConfigData, char* szFileName ) 
{
    USES_CONVERSION;

    CNtlFileSerializer nsl(1024 * 1024, 1024 * 1024);

    WCHAR* wszFileName;
    WCHAR* wszCryptPassword;

    mbstowcs(wszFileName, szFileName, sizeof(szFileName));
    mbstowcs(wszCryptPassword, CRYPT_PASSWORD, sizeof(CRYPT_PASSWORD));

    if (!nsl.LoadFile(wszFileName, TRUE, wszCryptPassword))
        return FALSE;

    std::string strAddr = "";
    std::string strLocalDsp = "";
    std::string strLocalSyncDsp = "";
    std::string strBugTrapServerIP ="";

    nsl>>strAddr;
    nsl>>pConfigData->dwPort;
    nsl>>strLocalDsp;
    nsl>>strLocalSyncDsp;
    nsl>>strBugTrapServerIP;
    nsl>>pConfigData->dwBugTrapServerPort;

    pConfigData->strAddr = A2W(strAddr.c_str());
    pConfigData->strLocalDsp = A2W(strLocalDsp.c_str());
    pConfigData->strLocalSyncDsp = A2W(strLocalSyncDsp.c_str());
    pConfigData->strBugTrapServerIP = A2W(strBugTrapServerIP.c_str());

    return TRUE;
}

BOOL CNtlScriptEncrypter::SaveConfigOption(SConfigData* pConfigData, char* szFileName, BOOL bEncrypt /* = FALSE */)
{
    if(!pConfigData || !szFileName)
        return FALSE;

    if(bEncrypt)
    {
        return SaveConfigOptionENC(pConfigData, szFileName, CRYPT_PASSWORD);
    }
    else
    {
        return SaveConfigOptionXML(pConfigData, szFileName);
    }    
}

BOOL CNtlScriptEncrypter::SaveConfigOptionXML( SConfigData* pConfigData, char* szFileName ) 
{
    USES_CONVERSION;

    CNtlXMLDoc doc;
    doc.Create();

    IXMLDOMProcessingInstruction* pPI    = NULL;        

    doc.GetDocument()->createProcessingInstruction(L"xml", L"version=\"1.0\" encoding = \"UTF-8\"", &pPI);
    if(!pPI)
        return FALSE;
    doc.GetDocument()->appendChild(pPI, NULL);

    IXMLDOMElement*     pElemRoot = NULL;                ///< Root Element
    IXMLDOMElement*     pElemOp = NULL;
    IXMLDOMElement*     pElemLocal = NULL;
    IXMLDOMElement*     pElemBUGTrap = NULL;

    doc.GetDocument()->createElement(L"config_options", &pElemRoot);
    doc.GetDocument()->appendChild(pElemRoot, NULL);

    WCHAR wbuf[1204] = {0,};

    doc.GetDocument()->createElement(L"op", &pElemOp);
    pElemOp->setAttribute(L"ver", (_variant_t)L"0.1");
    pElemOp->setAttribute(L"ip", (_variant_t)pConfigData->strAddr);
    swprintf_s(wbuf, L"%d", pConfigData->dwPort);
    pElemOp->setAttribute(L"port", (_variant_t)wbuf);    

    doc.GetDocument()->createElement(L"local", &pElemLocal);
    pElemLocal->setAttribute(L"ver", (_variant_t)L"0.1");
    pElemLocal->setAttribute(L"local_dsp", (_variant_t)pConfigData->strLocalDsp);
    pElemLocal->setAttribute(L"local_sync_dsp", (_variant_t)pConfigData->strLocalSyncDsp);    

    doc.GetDocument()->createElement(L"BUGTRAP", &pElemBUGTrap);
    pElemBUGTrap->setAttribute(L"ip", (_variant_t)pConfigData->strBugTrapServerIP);
    swprintf_s(wbuf, L"%d", pConfigData->dwBugTrapServerPort);
    pElemBUGTrap->setAttribute(L"port", (_variant_t)wbuf);

    pElemRoot->appendChild(pElemOp, NULL);
    pElemRoot->appendChild(pElemLocal, NULL);
    pElemRoot->appendChild(pElemBUGTrap, NULL);

    doc.SetIndent(L"indent.xsl");
    HRESULT hr = doc.GetDocument()->save((_variant_t)szFileName);
    if(hr != S_OK)
        return FALSE;

    return TRUE;
}

BOOL CNtlScriptEncrypter::SaveConfigOptionENC( SConfigData* pConfigData, char* szFileName, char* szCryptPassword ) 
{
    USES_CONVERSION;

    CNtlFileSerializer nsl(1024 * 1024, 1024 * 1024);

    std::string strAddr = W2A(pConfigData->strAddr);
    std::string strLocalDsp = W2A(pConfigData->strLocalDsp);
    std::string strLocalSyncDsp = W2A(pConfigData->strLocalSyncDsp);
    std::string strBugTrapServerIP = W2A(pConfigData->strBugTrapServerIP);

    nsl<<strAddr;
    nsl<<pConfigData->dwPort;
    nsl<<strLocalDsp;
    nsl<<strLocalSyncDsp;
    nsl<<strBugTrapServerIP;
    nsl<<pConfigData->dwBugTrapServerPort;

    return nsl.SaveFile(szFileName, TRUE, szCryptPassword);

    return TRUE;
}

NtlScriptEncrypter.h

class CNtlScriptEncrypter
{
public:
    CNtlScriptEncrypter(void);
    ~CNtlScriptEncrypter(void);

    static BOOL LoadConfigOption(OUT SConfigData* pConfigData, char* szFileName);             
    static BOOL SaveConfigOption(SConfigData* pConfigData, char* szFileName, BOOL bEncrypt = FALSE); 

protected:
    static BOOL LoadConfigOptionXML(OUT SConfigData* pConfigData, char* szFileName);
    static BOOL LoadConfigOptionENC(OUT SConfigData* pConfigData, char* szFileName);
    static BOOL SaveConfigOptionXML(SConfigData* pConfigData, char* szFileName);
    static BOOL SaveConfigOptionENC(SConfigData* pConfigData, char* szFileName, char* szCryptPassword);
}; 

NtlXMLDoc.cpp


#include "StdAfx.h"
#include <comdef.h>
#include <atlbase.h>
#include "NtlXMLDoc.h"
//#include "NtlAssert.h"


class CCoInit
{
public:
    CCoInit( void )
    {
        ::CoInitialize( NULL );
    }

    ~CCoInit( void )
    {
        ::CoUninitialize();
    }
};

CCoInit g_CoInit;

CNtlXMLDoc::CNtlXMLDoc(void)
{
    Init();
}

CNtlXMLDoc::~CNtlXMLDoc(void)
{
    Destroy();
}

bool CNtlXMLDoc::Create()
{
    if (NULL != m_pXMLDocument)
        return false;

    HRESULT hResult;

    hResult = ::CoCreateInstance(__uuidof(DOMDocument30), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXMLDOMDocument), (void**)&m_pXMLDocument);
    if (FAILED(hResult))
    {
        ::CoInitialize( NULL );
        hResult = ::CoCreateInstance(__uuidof(DOMDocument30), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXMLDOMDocument), (void**)&m_pXMLDocument);
        if (FAILED(hResult))
        {
            Destroy();
            return false;
        }
    }

    if (NULL == m_pXMLDocument)
    {
        Destroy();
        return false;
    }

    hResult = m_pXMLDocument->put_async(VARIANT_FALSE);
    if (FAILED(hResult))
    {
        Destroy();
        return false;
    }

    hResult = m_pXMLDocument->put_validateOnParse(VARIANT_FALSE);
    if (FAILED(hResult))
    {
        Destroy();
        return false;
    }

    hResult = m_pXMLDocument->put_resolveExternals(VARIANT_FALSE);
    if (FAILED(hResult))
    {
        Destroy();
        return false;
    }

    return true;
}

bool CNtlXMLDoc::Destroy()
{
    if (NULL != m_pXMLDocument)
    {
        m_pXMLDocument->Release();
        m_pXMLDocument = NULL;
    }

    m_bIsFileLoaded = false;

    return true;
}

void CNtlXMLDoc::Init()
{
    m_pXMLDocument = NULL;
    m_bIsFileLoaded = false;
}
bool CNtlXMLDoc::Load(WCHAR* pwszFileName, LONG* lLineNumber, BSTR* bstrErrorReasonString )
{
    if (false != m_bIsFileLoaded)
        return false;

    VARIANT_BOOL status = VARIANT_FALSE;
    HRESULT hResult = m_pXMLDocument->load((_variant_t)pwszFileName, &status);
    if (FAILED(hResult))
    {
        return false;
    }

    if (VARIANT_FALSE == status)
    {
        IXMLDOMParseError* pXMLError = NULL;
        m_pXMLDocument->get_parseError(&pXMLError);

        //BSTR bstrErrorReasonString;
        //LONG lLineNumber = 0;
        BSTR bstrSrcText;
        LONG lLinePosition = 0;

        pXMLError->get_srcText(&bstrSrcText);
        pXMLError->get_reason(bstrErrorReasonString);
        pXMLError->get_line(lLineNumber);
        pXMLError->get_linepos(&lLinePosition);

        //::SysFreeString(*bstrErrorReasonString);

        pXMLError->Release();

        return false;
    }

    m_bIsFileLoaded = true;

    return true;
}

bool CNtlXMLDoc::Load(WCHAR* pwszFileName )
{
    if (false != m_bIsFileLoaded)
        return false;

    VARIANT_BOOL status = VARIANT_FALSE;
    HRESULT hResult = m_pXMLDocument->load((_variant_t)pwszFileName, &status);
    if (FAILED(hResult))
    {
        return false;
    }

    if (VARIANT_FALSE == status)
    {
        IXMLDOMParseError* pXMLError = NULL;
        m_pXMLDocument->get_parseError(&pXMLError);

        BSTR bstrErrorReasonString;
        LONG lLineNumber = 0;
        BSTR bstrSrcText;
        LONG lLinePosition = 0;

        pXMLError->get_srcText(&bstrSrcText);
        pXMLError->get_reason(&bstrErrorReasonString);
        pXMLError->get_line(&lLineNumber);
        pXMLError->get_linepos(&lLinePosition);

        ::SysFreeString(bstrErrorReasonString);

        pXMLError->Release();

        return false;
    }

    m_bIsFileLoaded = true;

    return true;
}

bool CNtlXMLDoc::Load(char* pszFileName)
{
    if (false != m_bIsFileLoaded)
        return false;

    WCHAR wszUnicodeFileName[MAX_UNICODE_FILE_NAME_LENGTH + 1];
    ZeroMemory(wszUnicodeFileName, sizeof(WCHAR) * (MAX_UNICODE_FILE_NAME_LENGTH + 1));

    int iWrittenChars = ::MultiByteToWideChar(GetACP(), 0, pszFileName, -1, wszUnicodeFileName, MAX_UNICODE_FILE_NAME_LENGTH);
    wszUnicodeFileName[MAX_UNICODE_FILE_NAME_LENGTH] = L'[=14=]';

    if (0 == iWrittenChars)
        return false;

    return Load(wszUnicodeFileName);
}

bool CNtlXMLDoc::LoadXML( char* szXMLBuffer ) 
{
    USES_CONVERSION;

    if(false != m_bIsFileLoaded)
        return false;

    return LoadXML(A2W(szXMLBuffer));
}

bool CNtlXMLDoc::LoadXML( WCHAR* wszXMLBuffer ) 
{
    if (false != m_bIsFileLoaded)
        return false;

    VARIANT_BOOL status;    
    HRESULT hResult = m_pXMLDocument->loadXML(wszXMLBuffer, &status);

    if (FAILED(hResult))
    {
        return false;
    }

    if (VARIANT_FALSE == status)
    {
        IXMLDOMParseError* pXMLError = NULL;
        m_pXMLDocument->get_parseError(&pXMLError);

        BSTR bstrErrorReasonString;
        pXMLError->get_reason(&bstrErrorReasonString);
        ::SysFreeString(bstrErrorReasonString);

        pXMLError->Release();

        return false;
    }

    m_bIsFileLoaded = true;

    return true;
}


IXMLDOMNode* CNtlXMLDoc::SelectSingleNode(WCHAR* pwszXPath)
{
    if (false == m_bIsFileLoaded)
        return NULL;
    if (NULL == pwszXPath)
        return NULL;

    IXMLDOMNode* pXMLNode = NULL;

    BSTR bstrXPath = ::SysAllocString(pwszXPath);
    HRESULT hResult = m_pXMLDocument->selectSingleNode(bstrXPath, &pXMLNode);
    if (FAILED(hResult))
    {
        ::SysFreeString(bstrXPath);
        return NULL;
    }

    ::SysFreeString(bstrXPath);
    return pXMLNode;
}

IXMLDOMNode* CNtlXMLDoc::SelectSingleNode(char* pszXPath)
{
    if (false == m_bIsFileLoaded)
        return NULL;

    WCHAR wszUnicodeXPath[MAX_UNICODE_XPATH_LENGTH + 1];
    ZeroMemory(wszUnicodeXPath, sizeof(WCHAR) * (MAX_UNICODE_XPATH_LENGTH + 1));

    int iWrittenChars = ::MultiByteToWideChar(GetACP(), 0, pszXPath, -1, wszUnicodeXPath, MAX_UNICODE_XPATH_LENGTH);
    wszUnicodeXPath[MAX_UNICODE_XPATH_LENGTH] = L'[=14=]';

    if (0 == iWrittenChars)
        return NULL;

    return SelectSingleNode(wszUnicodeXPath);
}

IXMLDOMNodeList* CNtlXMLDoc::SelectNodeList(WCHAR* pwszXPath)
{
    if (false == m_bIsFileLoaded)
        return NULL;
    if (NULL == pwszXPath)
        return NULL;

    IXMLDOMNodeList* pXMLNodeList = NULL;

    BSTR bstrXPath = ::SysAllocString(pwszXPath);
    HRESULT hResult = m_pXMLDocument->selectNodes(bstrXPath, &pXMLNodeList);
    if (FAILED(hResult))
    {
        ::SysFreeString(bstrXPath);
        return NULL;
    }

    ::SysFreeString(bstrXPath);
    return pXMLNodeList;
}

IXMLDOMNodeList* CNtlXMLDoc::SelectNodeList(char* pszXPath)
{
    if (false == m_bIsFileLoaded)
        return NULL;

    WCHAR wszUnicodeXPath[MAX_UNICODE_XPATH_LENGTH + 1];
    ZeroMemory(wszUnicodeXPath, sizeof(WCHAR) * (MAX_UNICODE_XPATH_LENGTH + 1));

    int iWrittenChars = ::MultiByteToWideChar(GetACP(), 0, pszXPath, -1, wszUnicodeXPath, MAX_UNICODE_XPATH_LENGTH);
    wszUnicodeXPath[MAX_UNICODE_XPATH_LENGTH] = L'[=14=]';

    if (0 == iWrittenChars)
        return NULL;

    return SelectNodeList(wszUnicodeXPath);
}

bool CNtlXMLDoc::GetTextWithAttributeName(IXMLDOMNode* pNode, WCHAR* pwszAttributeName, WCHAR* pwszResultText, int nBufferSizeInWChars)
{
    if (NULL == pNode || NULL == pwszAttributeName || NULL == pwszResultText)
    {
        //      NtlAssertFail("NULL == pNode || NULL == pwszAttributeName || NULL == pwszResultText");
        return false;
    }
    if (0 >= nBufferSizeInWChars)
    {
        //      NtlAssertFail("0 >= nBufferSizeInWChars");
        return false;
    }

    IXMLDOMNamedNodeMap* pMap = NULL;
    pNode->get_attributes(&pMap);
    if (NULL == pMap)
    {
        //      NtlAssertFail("Couldn't get the attribute list from the given IXMLDOMNode.");
        return false;
    }

    IXMLDOMNode* pVirtualNode = NULL;
    pMap->getNamedItem(pwszAttributeName, &pVirtualNode);
    if (NULL == pVirtualNode)
    {
        //      NtlAssertFail("Couldn't find the given attribute name.");
        return false;
    }

    VARIANT var;
    VariantInit(&var);
    pVirtualNode->get_nodeValue(&var);

    if (wcslen(V_BSTR(&var)) >= (size_t)nBufferSizeInWChars)
    {
        //      NtlAssertFail("The buffer size is not enough to take the whole attribute value.");
        return false;
    }

    wcscpy_s(pwszResultText, nBufferSizeInWChars, V_BSTR(&var));

    return true;
}

bool CNtlXMLDoc::GetTextWithAttributeName(IXMLDOMNode* pNode, char* pszAttributeName, char* pszResultText, int nBufferSizeInBytes)
{
    if (NULL == pNode || NULL == pszAttributeName || NULL == pszResultText)
    {
        //      NtlAssertFail("NULL == pNode || NULL == pszAttributeName || NULL == pszResultText");
        return false;
    }
    if (0 >= nBufferSizeInBytes)
    {
        //      NtlAssertFail("0 >= nBufferSizeInBytes");
        return false;
    }

    int nRequiredBytes = 0;
    nRequiredBytes = MultiByteToWideChar(GetACP(), 0, pszAttributeName, -1, NULL, 0);
    if (0 == nRequiredBytes)
    {
        //      NtlAssertFail("The given attribute name can't be converted into WCHAR type for some reason.");
        return false;
    }
    if (nRequiredBytes > (CNtlXMLDoc::MAX_ATTRIBUTE_NAME_IN_WCHAR + 1))
    {
        //      NtlAssertFail("The given attribute name is too long.");
        return false;
    }

    WCHAR pwszAttributeNameInWChar[CNtlXMLDoc::MAX_ATTRIBUTE_NAME_IN_WCHAR + 1];

    int nUsedBufferSize = MultiByteToWideChar(GetACP(), 0, pszAttributeName, -1, pwszAttributeNameInWChar, (CNtlXMLDoc::MAX_ATTRIBUTE_NAME_IN_WCHAR + 1));
    if (0 == nUsedBufferSize)
    {
        //      NtlAssertFail("The given attribute name couldn't be converted into WCHAR type for some reason.");
        return false;
    }

    IXMLDOMNamedNodeMap* pMap = NULL;
    pNode->get_attributes(&pMap);
    if (NULL == pMap)
    {
        //      NtlAssertFail("Couldn't get the attribute list from the given IXMLDOMNode.");
        return false;
    }

    IXMLDOMNode* pVirtualNode = NULL;
    pMap->getNamedItem(pwszAttributeNameInWChar, &pVirtualNode);
    if (NULL == pVirtualNode)
    {
        //      NtlAssertFail("Couldn't find the given attribute name.");
        return false;
    }

    VARIANT var;
    VariantInit(&var);
    pVirtualNode->get_nodeValue(&var);

    nRequiredBytes = WideCharToMultiByte(::GetACP(), 0, V_BSTR(&var), -1, pszResultText, 0, NULL, NULL);
    if (nRequiredBytes > nBufferSizeInBytes)
    {
        //      NtlAssertFail("The buffer size is not enough to take the whole attribute value.");
        return false;
    }

    WideCharToMultiByte(GetACP(), 0, V_BSTR(&var), -1, pszResultText, nBufferSizeInBytes, NULL, NULL);
    return true;
}

bool CNtlXMLDoc::GetDataWithXPath(WCHAR* pwszXPath, WCHAR* pwszResultData, int nBufferSizeInWChars)
{
    if (NULL == pwszXPath || NULL == pwszResultData || 0 >= nBufferSizeInWChars)
        return false;

    IXMLDOMNode* pNode = NULL;    
    m_pXMLDocument->selectSingleNode(pwszXPath, &pNode);

    if(!pNode)
        return false;

    BSTR bstr = NULL;
    if (FAILED(pNode->get_text(&bstr)))
    {
        ::SysFreeString(bstr);
        pNode->Release();           
        return false;
    }

    wcscpy_s(pwszResultData, nBufferSizeInWChars, bstr);

    ::SysFreeString(bstr);
    pNode->Release();

    return true;
}

bool CNtlXMLDoc::GetDataWithXPath(char* pszXPath, char* pszResultData, int nBufferSizeInBytes)
{
    if (NULL == pszXPath || NULL == pszResultData || 0 >= nBufferSizeInBytes)
        return false;

    WCHAR wszUnicodeXPath[1024 + 1];

    int iRequiredChars = ::MultiByteToWideChar(GetACP(), 0, pszXPath, -1, NULL, 0);
    if (_countof(wszUnicodeXPath) < iRequiredChars)
        return false;

    int iWrittenChars = ::MultiByteToWideChar(GetACP(), 0, pszXPath, -1, wszUnicodeXPath, _countof(wszUnicodeXPath));
    if (0 == iWrittenChars)
        return false;
    wszUnicodeXPath[_countof(wszUnicodeXPath) - 1] = L'[=14=]';

    WCHAR wszUnicodeResultData[1024 + 1];
    if (false == GetDataWithXPath(wszUnicodeXPath, wszUnicodeResultData, _countof(wszUnicodeResultData)))
        return false;

    iRequiredChars = ::WideCharToMultiByte(GetACP(), 0, wszUnicodeResultData, -1, NULL, 0, NULL, NULL);
    if (nBufferSizeInBytes < iRequiredChars)
        return false;

    iWrittenChars = ::WideCharToMultiByte(GetACP(), 0, wszUnicodeResultData, -1, pszResultData, nBufferSizeInBytes, NULL, NULL);
    if (0 == iWrittenChars)
        return false;
    pszResultData[nBufferSizeInBytes - 1] = '[=14=]';

    return true;
}

/**
* XML ÆÄÀÏÀÇ ÇüŸ¦ TabÀ» ÀÌ¿ëÇؼ­ º¸±â ÁÁ°Ô Á¤·ÄÇÑ´Ù.
* \param szIndentFileName Á¤·Ä¿¡ »ç¿ëÇÒ ½ºÅ¸ÀÏ ½ÃÆ® ÆÄÀϸí
* return ¼º°ø À¯¹«
*/
bool CNtlXMLDoc::SetIndent(WCHAR* szIndentFileName)
{
    IXMLDOMDocument* pXSL = NULL;
    CoCreateInstance(__uuidof(DOMDocument30), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXMLDOMDocument), (void**)&pXSL);
    if(!pXSL)
        return false;

    VARIANT_BOOL vBool;
    pXSL->put_async(VARIANT_FALSE);
    pXSL->load((_variant_t)szIndentFileName, &vBool);

    VARIANT vObject;
    VariantInit(&vObject);
    vObject.vt = VT_DISPATCH;
    vObject.pdispVal = m_pXMLDocument;

    m_pXMLDocument->transformNodeToObject(pXSL, vObject);

    if(pXSL)
    {
        pXSL->Release();
        pXSL = NULL;
    }

    return true;
}

IXMLDOMDocument* CNtlXMLDoc::GetDocument(void)
{
    return m_pXMLDocument;
} 

控制台显示的一些错误:


 LNK2019    símbolo externo "public: bool __thiscall CNtlXMLDoc::GetTextWithAttributeName(struct IXMLDOMNode *,char *,char *,int)" (?GetTextWithAttributeName@CNtlXMLDoc@@QAE_NPAUIXMLDOMNode@@PAD1H@Z) sin resolver al que se hace referencia en la función "protected: static int __cdecl CNtlScriptEncrypter::LoadConfigOptionXML(struct _SConfigData *,char *)" (?LoadConfigOptionXML@CNtlScriptEncrypter@@KAHPAU_SConfigData@@PAD@Z)

我正在使用 MFC 和 VC Compiler 2010 在 VS 2019 中编译它。我想我在项目属性中链接了所有库和 headers。

我有大约 23 个错误与上面的错误几乎相同,都在同一个 obj 文件中并引用 NtlXMLDoc 函数。

如果你能给我一些建议,那就太好了。谢谢!

该项目不是我创建的,它是前段时间发布的代码,我正在尝试修复它

解决方案是:将包含 NtlXMLDoc.cpp 的项目添加到我项目资源管理器中的引用中,因为它们在同一个解决方案中,但是是不同的项目,我知道为什么通过属性没有'成功了