locked
why link error when I create RTS object? RRS feed

  • Question

  • why link error when I create RTS object? I had include RTSCom.h and add Uuid.lib 

    code is:

    IRealTimeStylus* CreateRealTimeStylus(HWND hWnd)
    {
        // Check input argument
        if (hWnd == NULL)
        {
            ASSERT(hWnd && L"CreateRealTimeStylus: invalid argument hWnd");
            return NULL;
        }

        // Create RTS object
        IRealTimeStylus* pRealTimeStylus = NULL;
        HRESULT hr = CoCreateInstance(CLSID_RealTimeStylus, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pRealTimeStylus));
        if (FAILED(hr))
        {
            ASSERT(SUCCEEDED(hr) && L"CreateRealTimeStylus: failed to CoCreateInstance of RealTimeStylus");
            return NULL;
        }

        // Attach RTS object to a window
        hr = pRealTimeStylus->put_HWND((HANDLE_PTR)hWnd);
        if (FAILED(hr))
        {
            ASSERT(SUCCEEDED(hr) && L"CreateRealTimeStylus: failed to set window handle");
            pRealTimeStylus->Release();
            return NULL;
        }

        // Register RTS object for receiving multi-touch input.
        IRealTimeStylus3* pRealTimeStylus3 = NULL;
        hr = pRealTimeStylus->QueryInterface(&pRealTimeStylus3);
        if (FAILED(hr))
        {
            ASSERT(SUCCEEDED(hr) && L"CreateRealTimeStylus: cannot access IRealTimeStylus3");
            pRealTimeStylus->Release();
            return NULL;
        }
        hr = pRealTimeStylus3->put_MultiTouchEnabled(TRUE);
        if (FAILED(hr))
        {
            ASSERT(SUCCEEDED(hr) && L"CreateRealTimeStylus: failed to enable multi-touch");
            pRealTimeStylus->Release();
            pRealTimeStylus3->Release();
            return NULL;
        }
        pRealTimeStylus3->Release();

        return pRealTimeStylus;
    }


    when I linking it said error below:

    1>IRealTimeStylusTestDlg.obj : error LNK2001: 无法解析的外部符号 _CLSID_RealTimeStylus


    • Edited by zhengbw Wednesday, November 20, 2013 3:05 AM
    Tuesday, November 19, 2013 9:41 AM

Answers

  • 将RTSCom.h,和RTSCom_i.c文件引入即可解决错误
    • Marked as answer by zhengbw Monday, November 25, 2013 2:53 AM
    Monday, November 25, 2013 2:53 AM